Programmable processor with group floating-point operations

ABSTRACT

A programmable processor that comprises a general purpose processor architecture, capable of operation independent of another host processor, having a virtual memory addressing unit, an instruction path and a data path; an external interface; a cache operable to retain data communicated between the external interface and the data path; at least one register file configurable to receive and store data from the data path and to communicate the stored data to the data path; and a multi-precision execution unit coupled to the data path. The multi-precision execution unit is configurable to dynamically partition data received from the data path to account for an elemental width of the data and is capable of performing group floating-point operations on multiple operands in partitioned fields of operand registers and returning catenated results. In other embodiments the multi-precision execution unit is additionally configurable to execute group integer and/or group data handling operations.

RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.09/922,319, filed on Aug. 2, 2001, now pending, which is a continuationof U.S. patent application Ser. No. 09/382,402, filed Aug. 24, 1999, nowU.S. Pat. No. 6,295,599, which is a continuation-in-part of U.S. patentapplication Ser. No. 09/169,963, filed Oct. 13, 1998, now U.S. Pat. No.6,006,318, which is a continuation of U.S. patent application Ser. No.08/754,827, filed Nov. 22, 1996 now U.S. Pat. No. 5,822,603, which is adivisional of U.S. patent application Ser. No. 08/516,036, filed Aug.16, 1995 now U.S. Pat. No. 5,742,840. U.S. application Ser. No.09/022,319, filed on Aug. 2, 2001, now pending is herein incorporated byreference in its entirety.

FIELD OF THE INVENTION

The present invention relates to general purpose processorarchitectures, and particularly relates to wide operand architectures.

REFERENCE TO A “SEQUENCE LISTING,” A TABLE, OR A COMPUTER

N/A

PROGRAM LISTING APPENDIX SUBMITTED ON A COMPACT DISK

This application includes an appendix, submitted herewith in duplicateon compact disks labeled as “Copy 1” and “Copy 2.” The contents of thecompact disks are hereby incorporated by reference.

BACKGROUND OF THE INVENTION

The performance level of a processor, and particularly a general purposeprocessor, can be estimated from the multiple of a plurality ofinterdependent factors: clock rate, gates per clock, number of operands,operand and data path width, and operand and data path partitioning.Clock rate is largely influenced by the choice of circuit and logictechnology, but is also influenced by the number of gates per clock.Gates per clock is how many gates in a pipeline may change state in asingle clock cycle. This can be reduced by inserting latches into thedata path: when the number of gates between latches is reduced, a higherclock is possible. However, the additional latches produce a longerpipeline length, and thus come at a cost of increased instructionlatency. The number of operands is straightforward; for example, byadding with carry-save techniques, three values may be added togetherwith little more delay than is required for adding two values. Operandand data path width defines how much data can be processed at once;wider data paths can perform more complex functions, but generally thiscomes at a higher implementation cost. Operand and data pathpartitioning refers to the efficient use of the data path as width isincreased, with the objective of maintaining substantially peak usage.

The last factor, operand and data path partitioning, is treatedextensively in commonly-assigned U.S. Pat. Nos. 5,742,840, 5,794,060,5,794,061, 5,809,321, and 5,822,603, which describe systems and methodsfor enhancing the utilization of a general purpose processor by addingclasses of instructions. These classes of instructions use the contentsof general purpose registers as data path sources, partition theoperands into symbols of a specified size, perform operations inparallel, catenate the results and place the catenated results into ageneral-purpose register. These patents, all of which are assigned tothe same assignee as the present invention, teach a general purposemicroprocessor which has been optimized for processing and transmittingmedia data streams through significant parallelism.

While the foregoing patents offered significant improvements inutilization and performance of a general purpose microprocessor,particularly for handling broadband communications such as media datastreams, other improvements are possible.

Many general purpose processors have general registers to store operandsfor instructions, with the register width matched to the size of thedata path. Processor designs generally limit the number of accessibleregisters per instruction because the hardware to access these registersis relatively expensive in power and area. While the number ofaccessible registers varies among processor designs, it is often limitedto two, three or four registers per instruction when such instructionsare designed to operate in a single processor clock cycle or a singlepipeline flow. Some processors, such as the Motorola 68000 haveinstructions to save and restore an unlimited number of registers, butrequire multiple cycles to perform such an instruction.

The Motorola 68000 also attempts to overcome a narrow data path combinedwith a narrow register file by taking multiple cycles or pipeline flowsto perform an instruction, and thus emulating a wider data path.However, such multiple precision techniques offer only marginalimprovement in view of the additional clock cycles required. The widthand accessible number of the general purpose registers thusfundamentally limits the amount of processing that can be performed by asingle instruction in a register-based machine.

Existing processors may provide instructions that accept operands forwhich one or more operands are read from a general purpose processor'smemory system. However, as these memory operands are generally specifiedby register operands, and the memory system data path is no wider thanthe processor data path, the width and accessible number of generalpurpose operands per instruction per cycle or pipeline flow is notenhanced.

The number of general purpose register operands accessible perinstruction is generally limited by logical complexity and instructionsize. For example, it might be possible to implement certain desirablebut complex functions by specifying a large number of general purposeregisters, but substantial additional logic would have to be added to aconventional design to permit simultaneous reading and bypassing of theregister values. While dedicated registers have been used in some priorart designs to increase the number or size of source operands orresults, explicit instructions load or store values into these dedicatedregisters, and additional instructions are required to save and restorethese registers upon a change of processor context.

There has therefore been a need for a processor system capable ofefficient handling of operands of greater width than either the memorysystem or any accessible general purpose register.

SUMMARY OF THE INVENTION

The present invention provides a system and method for improving theperformance of general purpose processors by expanding at least onesource operand to a width greater than the width of either the generalpurpose register or the data path width. In addition, several classes ofinstructions will be provided which cannot be performed efficiently ifthe operands are limited to the width and accessible number of generalpurpose registers.

In the present invention, operands are provided which are substantiallylarger than the data path width of the processor. This is achieved, inpart, by using a general purpose register to specify a memory addressfrom which at least more than one, but typically several data pathwidths of data can be read. To permit such a wide operand to beperformed in a single cycle, the data path functional unit is augmentedwith dedicated storage to which the memory operand is copied on aninitial execution of the instruction. Further execution of theinstruction or other similar instructions that specify the same memoryaddress can read the dedicated storage to obtain the operand value.However, such reads are subject to conditions to verify that the memoryoperand has not been altered by intervening instructions. If the memoryoperand remains current—that is, the conditions are met—the memoryoperand fetch can be combined with one or more register operands in thefunctional unit, producing a result. The size of the result is,typically, constrained to that of a general register so that nodedicated or other special storage is required for the result.

Exemplary instructions using wide operations include wide instructionsthat perform bit level switching (Wide Switch), byte or largertable-lookup (Wide Translate), Wide Multiply Matrix, Wide MultiplyMatrix Extract, Wide Multiply Matrix Extract Immediate, Wide MultiplyMatrix Floating point, and Wide Multiply Matrix Galois.

Another aspect of the present invention addresses efficient usage of amultiplier array that is fully used for high precision arithmetic, butis only partly used for other, lower precision operations. This can beaccomplished by extracting the high-order portion of the multiplierproduct or sum of products, adjusted by a dynamic shift amount from ageneral register or an adjustment specified as part of the instruction,and rounded by a control value from a register or instruction portion.The rounding may be any of several types, includinground-to-nearest/even, toward zero, floor, or ceiling. Overflows aretypically handled by limiting the result to the largest and smallestvalues that can be accurately represented in the output result.

When an extract is controlled by a register, the size of the result canbe specified, allowing rounding and limiting to a smaller number of bitsthan can fit in the result. This permits the result to be scaled for usein subsequent operations without concern of overflow or rounding. As aresult, performance is enhanced. In those instances where the extract iscontrolled by a register, a single register value defines the size ofthe operands, the shift amount and size of the result, and the roundingcontrol. By placing such control information in a single register, thesize of the instruction is reduced over the number of bits that such aninstruction would otherwise require, again improving performance andenhancing processor flexibility. Exemplary instructions are EnsembleConvolve Extract, Ensemble Multiply Extract, Ensemble Multiply AddExtract, and Ensemble Scale Add Extract. With particular regard to theEnsemble Scale Add Extract Instruction, the extract control informationis combined in a register with two values used as scalar multipliers tothe contents of two vector multiplicands. This combination reduces thenumber of registers otherwise required, thus reducing the number of bitsrequired for the instruction.

THE FIGURES

FIG. 1 is a system level diagram showing the functional blocks of asystem in accordance with an exemplary embodiment of the presentinvention.

FIG. 2 is a matrix representation of a wide matrix multiply inaccordance with an exemplary embodiment of the present invention.

FIG. 3 is a further representation of a wide matrix multiple inaccordance with an exemplary embodiment of the present invention.

FIG. 4 is a system level diagram showing the functional blocks of asystem incorporating a combined Simultaneous Multi Threading andDecoupled Access from Execution processor in accordance with anexemplary embodiment of the present invention.

FIG. 5 illustrates a wide operand in accordance with an exemplaryembodiment of the present invention.

FIG. 6 illustrates an approach to specifier decoding in accordance withan exemplary embodiment of the present invention.

FIG. 7 illustrates in operational block form a Wide Function Unit inaccordance with an exemplary embodiment of the present invention.

FIG. 8 illustrates in flow diagram form the Wide Microcache controlfunction in accordance with an exemplary embodiment of the presentinvention.

FIG. 9 illustrates Wide Microcache data structures in accordance with anexemplary embodiment of the present invention.

FIGS. 10 and 11 illustrate a Wide Microcache control in accordance withan exemplary embodiment of the present invention.

FIGS. 12A-12D illustrate a Wide Switch instruction in accordance with anexemplary embodiment of the present invention.

FIGS. 13A-13D illustrate a Wide Translate instruction in accordance withan exemplary embodiment of the present invention.

FIGS. 14A-14E illustrate a Wide Multiply Matrix instruction inaccordance with an exemplary embodiment of the present invention.

FIGS. 15A-15F illustrate a Wide Multiply Matrix Extract instruction inaccordance with an exemplary embodiment of the present invention.

FIGS. 16A-16E illustrate a Wide Multiply Matrix Extract Immediateinstruction in accordance with an exemplary embodiment of the presentinvention.

FIGS. 17A-17E illustrate a Wide Multiply Matrix Floating pointinstruction in accordance with an exemplary embodiment of the presentinvention.

FIGS. 18A-18D illustrate a Wide Multiply Matrix Galois instruction inaccordance with an exemplary embodiment of the present invention.

FIGS. 19A-19G illustrate an Ensemble Extract Inplace instruction inaccordance with an exemplary embodiment of the present invention.

FIGS. 20A-20J illustrate an Ensemble Extract instruction in accordancewith an exemplary embodiment of the present invention.

FIGS. 21A-21B illustrate a System and Privileged Library Calls inaccordance with an exemplary embodiment of the present invention.

FIGS. 22A-22B illustrate an Ensemble Scale-Add Floating-pointinstruction in accordance with an exemplary embodiment of the presentinvention.

FIGS. 23A-23C illustrate a Group Boolean instruction in accordance withan exemplary embodiment of the present invention.

FIGS. 24A-24C illustrate a Branch Hint instruction in accordance with anexemplary embodiment of the present invention.

FIGS. 25A-25C illustrate an Ensemble Sink Floating-point instruction inaccordance with an exemplary embodiment of the present invention.

FIGS. 26A-26C illustrate Group Add instructions in accordance with anexemplary embodiment of the present invention.

FIGS. 27A-27C illustrate Group Set instructions and Group Subtractinstructions in accordance with an exemplary embodiment of the presentinvention.

FIGS. 28A-28C illustrate Ensemble Convolve, Ensemble Divide, EnsembleMultiply, and Ensemble Multiply Sum instructions in accordance with anexemplary embodiment of the present invention.

FIG. 29 illustrates exemplary functions that are defined for use withinthe detailed instruction definitions in other sections.

FIGS. 30A-30C illustrate Ensemble Floating-Point Add, EnsembleFloating-Point Divide, and Ensemble Floating-Point Multiply instructionsin accordance with an exemplary embodiment of the present invention.

FIGS. 31A-31C illustrate Ensemble Floating-Point Subtract instructionsin accordance with an exemplary embodiment of the present invention.

FIGS. 32A-32D illustrate Crossbar Compress, Expand, Rotate, and Shiftinstructions in accordance with an exemplary embodiment of the presentinvention.

FIGS. 33A-33D illustrate Extract instructions in accordance with anexemplary embodiment of the present invention.

FIGS. 34A-34E illustrate Shuffle instructions in accordance with anexemplary embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Processor Layout

Referring first to FIG. 1, a general purpose processor is illustratedtherein in block diagram form. In FIG. 1, four copies of an access unitare shown, each with an access instruction fetch queue A-Queue 101-104.Each access instruction fetch queue A-Queue 101-104 is coupled to anaccess register file AR 105-108, which are each coupled to two accessfunctional units A 109-116. In a typical embodiment, each thread of theprocessor may have on the order of sixty-four general purpose registers(e.g., the AR's 105-108 and ER's 125-128). The access units functionindependently for four simultaneous threads of execution, and eachcompute program control flow by performing arithmetic and branchinstructions and access memory by performing load and storeinstructions. These access units also provide wide operand specifiersfor wide operand instructions. These eight access functional units A109-116 produce results for access register files AR 105-108 and memoryaddresses to a shared memory system 117-120.

In one embodiment, the memory hierarchy includes on-chip instruction anddata memories, instruction and data caches, a virtual memory facility,and interfaces to external devices. In FIG. 1, the memory system iscomprised of a combined cache and niche memory 117, an external businterface 118, and, externally to the device, a secondary cache 119 andmain memory system with I/O devices 120. The memory contents fetchedfrom memory system 117-120 are combined with execute instructions notperformed by the access unit, and entered into the four executeinstruction queues E-Queue 121-124. For wide instructions, memorycontents fetched from memory system 117-120 are also provided to wideoperand microcaches 132-136 by bus 137. Instructions and memory datafrom E-queue 121-124 are presented to execution register files 125-128,which fetch execution register file source operands. The instructionsare coupled to the execution unit arbitration unit Arbitration 131, thatselects which instructions from the four threads are to be routed to theavailable execution functional units E 141 and 149, X 142 and 148, G143-144 and 146-147, and T 145. The execution functional units E 141 and149, the execution functional units X 142 and 148, and the executionfunctional unit T 145 each contain a wide operand microcache 132-136,which are each coupled to the memory system 117 by bus 137.

The execution functional units G 143-144 and 146-147 are grouparithmetic and logical units that perform simple arithmetic and logicalinstructions, including group operations wherein the source and resultoperands represent a group of values of a specified symbol size, whichare partitioned and operated on separately, with results catenatedtogether. In a presently preferred embodiment the data path is 128 bitswide, although the present invention is not intended to be limited toany specific size of data path.

The execution functional units X 142 and 148 are crossbar switch unitsthat perform crossbar switch instructions. The crossbar switch units 142and 148 perform data handling operations on the data stream providedover the data path source operand buses 151-158, including deals,shuffles, shifts, expands, compresses, swizzles, permutes and reverses,plus the wide operations discussed hereinafter. In a key element of afirst aspect of the invention, at least one such operation will beexpanded to a width-greater than the general register and data pathwidth.

The execution functional units E 141 and 149 are ensemble units thatperform ensemble instructions using a large array multiplier, includinggroup or vector multiply and matrix multiply of operands partitionedfrom data path source operand buses 151-158 and treated as integer,floating point, polynomial or Galois field values. Matrix multiplyinstructions and other operations utilize a wide operand loaded into thewide operand microcache 132 and 136.

The execution functional unit T 145 is a translate unit that performstable-look-up operations on a group of operands partitioned from aregister operand, and catenates the result. The Wide Translateinstruction utilizes a wide operand loaded into the wide operandmicrocache 134.

The execution functional units E 141, 149, execution functional unitsX-142, 148, and execution functional unit T each contain dedicatedstorage to permit storage of source operands including wide operands asdiscussed hereinafter. The dedicated storage 132-136, which may bethought of as a wide microcache, typically has a width which is amultiple of the width of the data path operands related to the data pathsource operand buses 151-158. Thus, if the width of the data path151-158 is 128 bits, the dedicated storage 132-136 may have a width of256, 512, 1024 or 2048 bits. Operands which utilize the full width ofthe dedicated storage are referred to herein as wide operands, althoughit is not necessary in all instances that a wide operand use theentirety of the width of the dedicated storage; it is sufficient thatthe wide operand use a portion greater than the width of the memory datapath of the output of the memory system 117-120 and the functional unitdata path of the input of the execution functional units 141-149, thoughnot necessarily greater than the width of the two combined. Because thewidth of the dedicated storage 132-136 is greater than the width of thememory operand bus 137, portions of wide operands are loadedsequentially into the dedicated storage 132-136. However, once loaded,the wide operands may then be used at substantially the same time. Itcan be seen that functional units 141-149 and associated executionregisters 125-128 form a data functional unit, the exact elements ofwhich may vary with implementation.

The execution register file ER 125-128 source operands are coupled tothe execution units 141-145 using source operand buses 151-154 and tothe execution units 145-149 using source operand buses 155-158. Thefunction unit result operands from execution units 141-145 are coupledto the execution register file ER 125-128 using result bus 161 and thefunction units result operands from execution units 145-149 are coupledto the execution register file using result bus 162.

Wide Multiply Matrix

The wide operands of the present invention provide the ability toexecute complex instructions such as the wide multiply matrixinstruction shown in FIG. 2, which can be appreciated in an alternativeform, as well, from FIG. 3. As can be appreciated from FIGS. 2 and 3, awide operand permits, for example, the matrix multiplication of varioussizes and shapes which exceed the data path width. The example of FIG. 2involves a matrix specified by register rc having 128*64/size bits (512bits for this example) multiplied by a vector contained in register rbhaving 128 bits, to yield a result, placed in register rd, of 128 bits.

The notation used in FIG. 2 and following similar figures illustrates amultiplication as a shaded area at the intersection of two operandsprojected in the horizontal and vertical dimensions. A summing node isillustrated as a line segment connecting a darkened dots at the locationof multiplier products that are summed. Products that are subtracted atthe summing node are indicated with a minus symbol within the shadedarea.

When the instruction operates on floating-point values, themultiplications and summations illustrated are floating pointmultiplications and summations. An exemplary embodiment may performthese operations without rounding the intermediate results, thuscomputing the final result as if computed to infinite precision and thenrounded only once.

It can be appreciated that an exemplary embodiment of the multipliersmay compute the product in carry-save form and may encode the multiplierrb using Booth encoding to minimize circuit area and delay. It can beappreciated that an exemplary embodiment of such summing nodes mayperform the summation of the products in any order, with particularattention to minimizing computation delay, such as by performing theadditions in a binary or higher-radix tree, and may use carry-saveadders to perform the addition to minimize the summation delay. It canalso be appreciated that an exemplary embodiment may perform thesummation using sufficient intermediate precision that no fixed-point orfloating-point overflows occur on intermediate results.)

A comparison of FIGS. 2 and 3 can be used to clarify the relationbetween the notation used in FIG. 2 and the more conventional schematicnotation in FIG. 3, as the same operation is illustrated in these twofigures.

Wide Operand

The operands that are substantially larger than the data path width ofthe processor are provided by using a general-purpose register tospecify a memory specifier from which more than one but in someembodiments several data path widths of data can be read into thededicated storage. The memory specifier typically includes the memoryaddress together with the size and shape of the matrix of data beingoperated on. The memory specifier or wide operand specifier can bebetter appreciated from FIG. 5, in which a specifier 500 is seen to bean address, plus a field representative of the size/2 and a furtherfield representative of width/2, where size is the product of the depthand width of the data. The address is aligned to a specified size, forexample sixty four bytes, so that a plurality of low order bits (forexample, six bits) are zero. The specifier 500 can thus be seen tocomprise a first field 505 for the address, plus two field indicia 510within the low order six bits to indicate size and width.

Specifier Decoding

The decoding of the specifier 500 may be further appreciated from FIG. 6where, for a given specifier 600 made up of an address field 605together with a field 610 comprising plurality of low order bits. By aseries of arithmetic operations shown at steps 615 and 620, the portionof the field 610 representative of width/2 is developed. In a similarseries of steps shown at 625 and 630, the value of t is decoded, whichcan then be used to decode both size and address. The portion of thefield 610 representative of size/2 is decoded as shown at steps 635 and640, while the address is decoded in a similar way at steps 645 and 650.

Wide Function Unit

The wide function unit may be better appreciated from FIG. 7, in which aregister number 700 is provided to an operand checker 705. Wide operandspecifier 710 communicates with the operand checker 705 and alsoaddresses memory 715 having a defined memory width. The memory addressincludes a plurality of register operands 720A n, which are accumulatedin a dedicated storage portion 714 of a data functional unit 725. In theexemplary embodiment shown in FIG. 7, the dedicated storage 71.4 can beseen to have a width equal to eight data path widths, such that eightwide operand portions 730A-H are sequentially loaded into the dedicatedstorage to form the wide operand. Although eight portions are shown inFIG. 7, the present invention is not limited to eight or any otherspecific multiple of data path widths. Once the wide operand portions730A-H are sequentially loaded, they may be used as a single wideoperand 735 by the functional element 740, which may be any element(s)from FIG. 1 connected thereto. The result of the wide operand is thenprovided to a result register 745, which in a presently preferredembodiment is of the same width as the memory width.

Once the wide operand is successfully loaded into the dedicated storage714, a second aspect of the present invention may be appreciated.Further execution of this instruction or other similar instructions thatspecify the same memory address can read the dedicated storage to obtainthe operand value under specific conditions that determine whether thememory operand has been altered by intervening instructions. Assumingthat these conditions are met, the memory operand fetch from thededicated storage is combined with one or more register operands in thefunctional unit, producing a result. In some embodiments, the size ofthe result is limited to that of a general register, so that no similardedicated storage is required for the result. However, in some differentembodiments, the result may be a wide operand, to further enhanceperformance.

To permit the wide operand value to be addressed by subsequentinstructions specifying the same memory address, various conditions mustbe checked and confirmed:

Those conditions include:

Each memory store instruction checks the memory address against thememory addresses recorded for the dedicated storage. Any match causesthe storage to be marked invalid, since a memory store instructiondirected to any of the memory addresses stored in dedicated storage 714means that data has been overwritten.

The register number used to address the storage is recorded. If nointervening instructions have written to the register, and the sameregister is used on the subsequent instruction, the storage is valid(unless marked invalid by rule #1).

If the register has been modified or a different register number isused, the value of the register is read and compared against the addressrecorded for the dedicated storage. This uses more resources than #1because of the need to fetch the register contents and because the widthof the register is greater than that of the register number itself. Ifthe address matches, the storage is valid. The new register number isrecorded for the dedicated storage.

If conditions #2 or #3 are not met, the register contents are used toaddress the general-purpose processor's memory and load the dedicatedstorage. If dedicated storage is already fully loaded, a portion of thededicated storage must be discarded (victimized) to make room for thenew value. The instruction is then performed using the newly updateddedicated storage. The address and register number is recorded for thededicated storage.

By checking the above conditions, the need for saving and restoring thededicated storage is eliminated. In addition, if the context of theprocessor is changed and the new context does not employ Wideinstructions that reference the same dedicated storage, when theoriginal context is restored, the contents of the dedicated storage areallowed to be used without refreshing the value from memory, usingchecking rule #3. Because the values in the dedicated storage are readfrom memory and not modified directly by performing wide operations, thevalues can be discarded at any time without saving the results intogeneral memory. This property simplifies the implementation of rule #4above.

An alternate embodiment of the present invention can replace rule #1above with the following rule:

1a. Each memory store instruction checks the memory address against thememory addresses recorded for the dedicated storage. Any match causesthe dedicated storage to be updated, as well as the general memory.

By use of the above rule 1.a, memory store instructions can modify thededicated storage, updating just the piece of the dedicated storage thathas been changed, leaving the remainder intact. By continuing to updatethe general memory, it is still true that the contents of the dedicatedmemory can be discarded at any time without saving the results intogeneral memory. Thus rule #4 is not made more complicated by thischoice. The advantage of this alternate embodiment is that the dedicatedstorage need not be discarded (invalidated) by memory store operations.

Wide Microcache Data Structures

Referring next to FIG. 9, an exemplary arrangement of the datastructures of the wide microcache or dedicated storage 114 may be betterappreciated. The wide microcache contents, wmc.c, can be seen to form aplurality of data path widths 900A-n, although in the example shown thenumber is eight. The physical address, wmc.pa, is shown as 64 bits inthe example shown, although the invention is not limited to a specificwidth. The size of the contents, wmc.size, is also provided in a fieldwhich is shown as 10 bits in an exemplary embodiment. A “contents valid”flag, wmc.cv, of one bit is also included in the data structure,together with a two bit field for thread last used, or wmc.th. Inaddition, a six bit field for register last used, wmc.reg, is providedin an exemplary embodiment. Further, a one bit flag for register andthread valid, or wmc.itv, may be provided.

Wide Microcache Control—Software

The process by which the microcache is initially written with a wideoperand, and thereafter verified as valid for fast subsequentoperations, may be better appreciated from FIG. 8. The process begins at800, and progresses to step 805 where a check of the register contentsis made against the stored value wmc.rc. If true, a check is made atstep 810 to verify the thread. If true, the process then advances tostep 815 to verify whether the register and thread are valid. If step815 reports as true, a check is made at step 820 to verify whether thecontents are valid. If all of steps 805 through 820 return as true, thesubsequent instruction is able to utilize the existing wide operand asshown at step 825, after which the process ends. However, if any ofsteps 805 through 820 return as false, the process branches to step 830,where content, physical address and size are set. Because steps 805through 820 all lead to either step 825 or 830, steps 805 through 820may be performed in any order or simultaneously without altering theprocess. The process then advances to step 835 where size is checked.This check basically ensures that the size of the translation unit isgreater than or equal to the size of the wide operand, so that aphysical address can directly replace the use of a virtual address. Theconcern is that, in some embodiments, the wide operands may be largerthan the minimum region that the virtual memory system is capable ofmapping. As a result, it would be possible for a single contiguousvirtual address range to be mapped into multiple, disjoint physicaladdress ranges, complicating the task of comparing physical addresses.By determining the size of the wide operand and comparing that sizeagainst the size of the virtual address mapping region which isreferenced, the instruction is aborted with an exception trap if thewide operand is larger than the mapping region. This ensures secureoperation of the processor. Software can then re-map the region using alarger size map to continue execution if desired. Thus, if size isreported as unacceptable at step 835, an exception is generated at step840. If size is acceptable, the process advances to step 845 wherephysical address is checked. If the check reports as met, the processadvances to step 850, where a check of the contents valid flag is made.If either check at step 845 or 850 reports as false, the processbranches and new content is written into the dedicated storage 114, withthe fields thereof being set accordingly. Whether the check at step 850reported true, or whether new content was written at step 855, theprocess advances to step 860 where appropriate fields are set toindicate the validity of the data, after which the requested functioncan be performed at step 825. The process then ends.

Wide Microcache Control—Hardware

Referring next to FIGS. 10 and 11, which together show the operation ofthe microcache controller from a hardware standpoint, the operation ofthe microcache controller may be better understood. In the hardwareimplementation, it is clear that conditions which are indicated assequential steps in FIGS. 8 and 9 above can be performed in parallel,reducing the delay for such wide operand checking. Further, a copy ofthe indicated hardware may be included for each wide microcache, andthereby all such microcaches as may be alternatively referenced by aninstruction can be tested in parallel. It is believed that no furtherdiscussion of FIGS. 10 and 11 is required in view of the extensivediscussion of FIGS. 8 and 9, above.

Various alternatives to the foregoing approach do exist for the use ofwide operands, including an implementation in which a single instructioncan accept two wide operands, partition the operands into symbols,multiply corresponding symbols together, and add the products to producea single scalar value or a vector of partitioned values of width of theregister file, possibly after extraction of a portion of the sums. Suchan instruction can be valuable for detection of motion or estimation ofmotion in video compression. A further enhancement of such aninstruction can incrementally update the dedicated storage if theaddress of one wide operand is within the range of previously specifiedwide operands in the dedicated storage, by loading only the portion notalready within the range and shifting the in-range portion as required.Such an enhancement allows the operation to be performed over a “slidingwindow” of possible values. In such an instruction, one wide operand isaligned and supplies the size and shape information, while the secondwide operand, updated incrementally, is not aligned.

Another alternative embodiment of the present invention can defineadditional instructions where the result operand is a wide operand. Suchan enhancement removes the limit that a result can be no larger than thesize of a general register, further enhancing performance. These wideresults can be cached locally to the functional unit that created them,but must be copied to the general memory system before the storage canbe reused and before the virtual memory system alters the mapping of theaddress of the wide result. Data paths must be added so that loadoperations and other wide operations can read these wideresults—forwarding of a wide result from the output of a functional unitback to its input is relatively easy, but additional data paths may haveto be introduced if it is desired to forward wide results back to otherfunctional units as wide operands.

As previously discussed, a specification of the size and shape of thememory operand is included in the low-order bits of the address. In apresently preferred implementation, such memory operands are typically apower of two in size and aligned to that size. Generally, one half thetotal size is added (or inclusively or'ed, or exclusively or'ed) to thememory address, and one half of the data width is added (or inclusivelyor'ed, or exclusively or'ed) to the memory address. These bits can bedecoded and stripped from the memory address, so that the controller ismade to step through all the required addresses. This decreases thenumber of distinct operands required for these instructions, as thesize, shape and address of the memory operand are combined into a singleregister operand value.

The following table illustrates the arithmetic and descriptive notationused in the pseudocode in the Figures referenced hereinafter:

x + y two's complement addition of x and y. Result is the same size asthe operands, and operands must be of equal size. x − y two's complementsubtraction of y from x. Result is the same size as the operands, andoperands must be of equal size. x * y two's complement multiplication ofx and y. Result is the same size as the operands, and operands must beof equal size. x/y two's complement division of x by y. Result is thesame size as the operands, and operands must be of equal size. x & ybitwise and of x and y. Result is same size as the operands, andoperands must be of equal size. x||y bitwise or of x and y. Result issame size as the operands, and operands must be of equal size. x{circumflex over ( )}y bitwise exclusive-of of x and y. Result is samesize as the operands, and operands must be of equal size. ~x bitwiseinversion of x. Result is same size as the operand. x = y two'scomplement equality comparison between x and y. Result is a single bit,and operands must be of equal size. x ≠ y two's complement inequalitycomparison between x and y. Result is a single bit, and operands must beof equal size. x < y two's complement less than comparison between x andy. Result is a single bit, and operands must be of equal size. x ≧ ytwo's complement greater than or equal comparison between x and y.Result is a single bit, and operands must be of equal size. {square rootover (x)} floating-point square root of x x||y concatenation of bitfield x to left of bit field y _(x)y binary digit x repeated,concatenated y times. Size of result is y. x_(y) extraction of bit y(using little-endian bit numbering) from value x. Result is a singlebit. x_(y . . . z) extraction of bit field formed from bits y through zof value x. Size of result is −z + 1; if z > y, result is an emptystring, x?y:z value of y, if x is true, otherwise value of z. Value of xis a single bit. x ←y bitwise assignment of x to value of y x.y subfieldof structured bitfield x Sn signed, two's complement, binary data formatof n bytes Un unsigned binary data format of n bytes Fn floating-pointdata format of n bytes

Wide Operations

Particular examples of wide operations which are defined by the presentinvention include the Wide Switch instruction that performs bit-levelswitching; the Wide Translate instruction which performs byte (orlarger) table lookup; Wide Multiply Matrix; Wide Multiply Matrix Extractand Wide Multiply Matrix Extract Immediate (discussed below), WideMultiply Matrix Floating-point, and Wide Multiply Matrix Galois (alsodiscussed below). While the discussion below focuses on particular sizesfor the exemplary instructions, it will be appreciated that theinvention is not limited to a particular width.

Wide Switch

An exemplary embodiment of the Wide Switch instruction is shown in FIGS.12A-12D. In an exemplary embodiment, the Wide Switch instructionrearranges the contents of up to two registers (256 bits) at the bitlevel, producing a full-width (128 bits) register result. To control therearrangement, a wide operand specified by a single register, consistingof eight bits per bit position is used. For each result bit position,eight wide operand bits for each bit position select which of the 256possible source register bits to place in the result. When a wideoperand size smaller than 128 bytes is specified, the high order bits ofthe memory operand are replaced with values corresponding to the resultbit position, so that the memory operand specifies a bit selectionwithin symbols of the operand size, performing the same operation oneach symbol.

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, a second operandfrom a general register, perform a group of operations on partitions ofbits in the operands, and catenate the results together, placing theresult in a general register. An exemplary embodiment of the format 1210of the Wide Switch instruction is shown in FIG. 12A.

An exemplary embodiment of a schematic 1230 of the Wide Switchinstruction is shown in FIG. 12B. In an exemplary embodiment, thecontents of register rc specifies a virtual address apd optionally anoperand size, and a value of specified size is loaded from memory. Asecond value is the catenated contents of registers rd and rb. Eightcorresponding bits from the memory value are used to select a singleresult bit from the second value, for each corresponding bit position.The group of results is catenated and placed in register ra.

In an exemplary embodiment, the virtual address must either be alignedto 128 bytes, or must be the sum of an aligned address and one-half ofthe size of the memory operand in bytes. An aligned address must be anexact multiple of the size expressed in bytes. The size of the memoryoperand must be 8, 16, 32, 64, or 128 bytes. If the address is not validan “access disallowed by virtual address” exception occurs. When a sizesmaller than 128 bits is specified, the high order bits of the memoryoperand are replaced with values corresponding to the bit position, sothat the same memory operand specifies a bit selection within symbols ofthe operand size, and the same operation is performed on each symbol.

In an exemplary embodiment, a wide switch (W.SWITCH.L or W.SWITCH.B)instruction specifies an 8-bit location for each result bit from thememory operand, that selects one of the 256 bits represented by thecatenated contents of registers rd and rb.

An exemplary embodiment of the pseudocode 1250 of the Wide Switchinstruction is shown in FIG. 12C. An exemplary embodiment of theexceptions 1280 of the Wide Switch instruction is shown in FIG. 12D.

Wide Translate

An exemplary embodiment of the Wide Translate instruction is shown inFIGS. 13A-13D. In an exemplary embodiment, the Wide Translateinstructions use a wide operand to specify a table of depth up to 256entries and width of up to 128 bits. The contents of a register ispartitioned into operands of one, two, four, or eight bytes, and thepartitions are used to select values from the table in parallel. Thedepth and width of the table can be selected by specifying the size andshape of the wide operand as described above.

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, a second operandfrom a general register, perform a group of operations on partitions ofbits in the operands, and catenate the results together, placing theresult in a general register. An exemplary embodiment of the format 1310of the Wide Translate instruction is shown in FIG. 13A.

An exemplary embodiment of the schematic 1330 of the Wide Translateinstruction is shown in FIG. 13B. In an exemplary embodiment, thecontents of register rc is used as a virtual address, and a value ofspecified size is loaded from memory. A second value is the contents ofregister rb. The values are partitioned into groups of operands of asize specified. The low-order bytes of the second group of values areused as addresses to choose entries from one or more tables constructedfrom the first value, producing a group of values. The group of resultsis catenated and placed in register rd.

In an exemplary embodiment, by default, the total width of tables is 128bits, and a total table width of 128, 64, 32, 16 or 8 bits, but not lessthan the group size may be specified by adding the desired total tablewidth in bytes to the specified address: 16, 8, 4, 2, or 1. When fewerthan 128 bits are specified, the tables repeat to fill the 128 bitwidth.

In an exemplary embodiment, the default depth of each table is 256entries, or in bytes is 32 times the group size in bits. An operationmay specify 4, 8, 16, 32, 64, 128 or 256 entry tables, by adding onehalf of the memory operand size to the address. Table index values aremasked to ensure that only the specified portion of the table is used.Tables with just 2 entries cannot be specified; if 2-entry tables aredesired, it is recommended to load the entries into registers and useG.MUX to select the table entries.

In an exemplary embodiment, failing to initialize the entire table is apotential security hole, as an instruction in with a small-depth tablecould access table entries previously initialized by an instruction witha large-depth table. This security hole may be closed either byinitializing the entire table, even if extra cycles are required, or bymasking the index bits so that only the initialized portion of the tableis used. An exemplary embodiment may initialize the entire table with nopenalty in cycles by writing to as many as 128 table entries at once.Initializing the entire table with writes to only one entry at a timerequires writing 256 cycles, even when the table is smaller. Masking theindex bits is the preferred solution.)

In an exemplary embodiment, masking the index bits suggests that thisinstruction, for tables larger than 256 entries, may be extended to ageneral-purpose memory translate function where the processor performsenough independent load operations to fill the 128 bits. Thus, the 16,32, and 64 bit versions of this function perform equivalent of 8, 4, 2withdraw, 8, 4, or 2 load-indexed and 7, 3, or 1 group-extractinstructions. In other words, this instruction can be as powerful as 23,11, or 5 previously existing instructions. The 8-bit version is a singlecycle operation replacing 47 existing instructions, so these extensionsare not as powerful, but nonetheless, this is at least a 50% improvementon a 2-issue processor, even with one cycle per load timing. To makethis possible, the default table size would become 65536, 2̂32 and 2̂64for 16, 32 and 64-bit versions of the instruction.

In an exemplary embodiment, for the big-endian version of thisinstruction, in the definition below, the contents of register rb iscomplemented. This reflects a desire to organize the table so that thelowest. addressed table entries are selected when the index is zero. Inthe logical implementation, complementing the index can be avoided byloading the table memory differently for big-endian and little-endianversions; specifically by loading the table into memory so that thehighest-addressed table entries are selected when the index is zero fora big-endian version of the instruction. In an exemplary embodiment ofthe logical implementation, complementing the index can be avoided byloading the table memory differently for big-endian and little-endianversions. In order to avoid complementing the index, the table memory isloaded differently for big-endian versions of the instruction bycomplementing the addresses at which table entries are written into thetable for a big-endian version of the instruction.

In an exemplary embodiment, the virtual address must either be alignedto 4096 bytes, or must be the sum of an aligned address and one-half ofthe size of the memory operand in bytes and/or the desired total tablewidth in bytes. An aligned address must be an exact multiple of the sizeexpressed in bytes. The size of the memory operand must be a power oftwo from 4 to 4096 bytes, but must be at least 4 times the group sizeand 4 times the total table width. If the address is not valid an“access disallowed by virtual address” exception occurs.

In an exemplary embodiment, a wide translate (W.TRANSLATE.8.L orW.TRANSLATE.8.B) instruction specifies a translation table of 16 entries(vsize=16) in depth, a group size of 1 byte (gsize=8 bits), and a widthof 8 bytes (wsize=64 bits). The address specifies a total table size(msize=1024 bits=vsize*wsize) and a table width (wsize=64 bits) byadding one half of the size in bytes of the table (64) and adding thesize in bytes of the table width (8) to the table address in the addressspecification. The instruction will create duplicates of this table inthe upper and lower 64 bits of the data path, so that 128 bits ofoperand are processed at once, yielding a 128 bit result.

An exemplary embodiment of the pseudocode 1350 of the Wide Translateinstruction is shown in FIG. 13C. An exemplary embodiment of theexceptions 1380 of the Wide Translate instruction is shown in FIG. 13D.

Wide Multiply Matrix

An exemplary embodiment of the Wide Multiply Matrix instruction is shownin FIGS. 14A-14E. In an exemplary embodiment, the Wide Multiply Matrixinstructions use a wide operand to specify a matrix of values of widthup to 64 bits (one half of register file and data path width) and depthof up to 128 bits/symbol size. The contents of a general register (128bits) is used as a source operand, partitioned into a vector of symbols,and multiplied with the matrix, producing a vector of width up to 128bits of symbols of twice the size of the source operand symbols. Thewidth and depth of the matrix can be selected by specifying the size andshape of the wide operand as described above. Controls within theinstruction allow specification of signed, mixed signed, unsigned,complex, or polynomial operands.

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, a second operandfrom a general register, perform a group of operations on partitions ofbits in the operands, and catenate the results together, placing theresult in a general register. An exemplary embodiment of the format 1410of the Wide Multiply Matrix instruction is shown in FIG. 14A.

An exemplary embodiment of the schematics 1430 and 1460 of the WideMultiply Matrix instruction is shown in FIGS. 14B and 14C. In anexemplary embodiment, the contents of register rc is used as a virtualaddress, and a value of specified size is loaded from memory. A secondvalue is the contents of register rb. The values are partitioned intogroups of operands of the size specified. The second values aremultiplied with the first values, then summed, producing a group ofresult values. The group of result values is catenated and placed inregister rd.

In an exemplary embodiment, the memory multiply instructions (W.MUL.MAT,W.MUL.MAT.C, W.MUL.MAT.M, W.MUL.MAT.P, W.MUL.MAT.U) perform apartitioned array multiply of up to 8192 bits, that is 64×128 bits. Thewidth of the array can be limited to 64, 32, or 16 bits, but not smallerthan twice the group size, by adding one half the desired size in bytesto the virtual address operand: 4, 2, or 1. The array can be limitedvertically to 128, 64, 32, or 16 bits, but not smaller than twice thegroup size, by adding one-half the desired memory operand size in bytesto the virtual address operand.

In an exemplary embodiment, the virtual address must either be alignedto 1024/gsize bytes (or 512/gsize for W.MUL.MAT.C) (with gsize measuredin bits), or must be the sum of an aligned address and one half of thesize of the memory operand in bytes and/or one quarter of the size ofthe result in bytes. An aligned address must be an exact multiple of thesize expressed in bytes. If the address is not valid an “accessdisallowed by virtual address” exception occurs.

In an exemplary embodiment, a wide multiply octlets instruction(W.MUL.MAT.type.64, type=NONE M U P) is not implemented and causes areserved instruction exception, as an ensemble-multiply-sum-octletsinstruction (E.MUL.SUM.type.64) performs the same operation except thatthe multiplier is sourced from a 128-bit register rather than memory.Similarly, instead of wide-multiply-complex-quadlets instruction(W.MUL.MAT.C.32), one should use an ensemble-multiply-complex-quadletsinstruction (E.MUL.SUM.C.32).

As shown in FIG. 14B, an exemplary embodiment of awide-multiply-doublets instruction (W.MUL.MAT, W.MUL.MAT.M, W.MUL.MAT.P,W.MUL.MAT.U) multiplies memory [m31 m30 . . . m1 m0] with vector [h g fe d c b a], yielding products [hm31+gm27+ . . . +bm7+am3 . . .hm28+gm24+ . . . +bm4+am0].

As shown in FIG. 14C, an exemplary embodiment of awide-multiply-matrix-complex-doublets instruction (W.MUL.MAT.C)multiplies memory [m15 m14 . . . m1 m0] with vector [h g f e d c b a],yielding products [hm14+gm15+ . . . +bm2+am3 . . . hm12+gm13+ . . .+bm0+am1 hm13+gm12+ . . . bm1+am0].

An exemplary embodiment of the pseudocode 1480 of the Wide MultiplyMatrix instruction is shown in FIG. 14D. An exemplary embodiment of theexceptions 1490 of the Wide Multiply Matrix instruction is shown in FIG.14E.

Wide Multiply Matrix Extract

An exemplary embodiment of the Wide Multiply Matrix Extract instructionis shown in FIGS. 15A-15F. In an exemplary embodiment, the Wide MultiplyMatrix Extract instructions use a wide operand to specify a matrix ofvalue of width up to 128 bits (full width of register file and datapath) and depth of up to 128 bits/symbol size. The contents of a generalregister (128 bits) is used as a source operand, partitioned into avector of symbols, and multiplied with the matrix, producing a vector ofwidth up to 256 bits of symbols of twice the size of the source operandsymbols plus additional bits to represent the sums of products withoutoverflow. The results are then extracted in a manner described below(Enhanced Multiply Bandwidth by Result Extraction), as controlled by thecontents of a general register specified by the instruction. The generalregister also specifies the format of the operands: signed,mixed-signed, unsigned, and complex as well as the size of the operands,byte (8 bit), doublet (16 bit), quadlet (32 bit), or hexlet (64 bit).

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, a second operandfrom a general register, perform a group of operations on partitions ofbits in the operands, and catenate the results together, placing theresult in a general register. An exemplary embodiment of the format 1510of the Wide Multiply Matrix Extract instruction is shown in FIG. 15A.

An exemplary embodiment of the schematics 1530 and 1560 of the WideMultiply Matrix Extract instruction is shown in FIGS. 15C and 14D. In anexemplary embodiment, the contents of register rc is used as a virtualaddress, and a value of specified size is loaded from memory. A secondvalue is the contents of register rd. The group size and otherparameters are specified from the contents of register rb. The valuesare partitioned into groups of operands of the size specified and aremultiplied and summed, producing a group of values. The group of valuesis rounded, and limited as specified, yielding a group of results whichis the size specified. The group of results is catenated and placed inregister ra.

In an exemplary embodiment, the size of this operation is determinedfrom the contents of register rb. The multiplier usage is constant, butthe memory operand size is inversely related to the group size.Presumably this can be checked for cache validity.

In an exemplary embodiment, low order bits of re are used to designate asize, which must be consistent with the group size. Because the memoryoperand is cached, the size can also be cached, thus eliminating thetime required to decode the size, whether from rb or from rc.

In an exemplary embodiment, the wide multiply matrix extractinstructions (W.MUL.MAT.X.B, W.MUL.MAT.X.L) perform a partitioned arraymultiply of up to 16384 bits, that is 128×128 bits. The width of thearray can be limited to 128, 64, 32, or 16 bits, but not smaller thantwice the group size, by adding one half the desired size in bytes tothe virtual address operand: 8, 4, 2, or 1. The array can be limitedvertically to 128, 64, 32, or 16 bits, but not smaller than twice thegroup size, by adding one half the desired memory operand size in bytesto the virtual address operand.

As shown in FIG. 15B, in an exemplary embodiment, bits 31 . . . 0 of thecontents of register rb specifies several parameters which control themanner in which data is extracted. The position and default values ofthe control fields allow for the source position to be added to a fixedcontrol value for dynamic computation, and allow for the lower 16 bitsof the control field to be set for some of the simpler extract cases bya single GCOPYI instruction.

In an exemplary embodiment, the table below describes the meaning ofeach label:

label bits meaning fsize 8 field size dpos 8 destination position x 1reserved s 1 signed vs. unsigned n 1 complex vs. real multiplication m 1mixed-sign vs. same-sign multiplication l 1 saturation vs. truncationrnd 2 rounding gssp 9 group size and source position

In an exemplary embodiment, the 9 bit gssp field encodes both the groupsize, gsize, and source position, spos, according to the formulagssp=512 4*gsize+spos. The group size, gsize, is a power of two in therange 1 . . . 128. The source position, spos, is in the range 0 . . .(2*gsize) 1.

In an exemplary embodiment, the values in the s, n, m, t, and rnd fieldshave the following meaning:

values s n m I rnd 0 unsigned real same- truncate F sign 1 signedcomplex mixed- saturate Z sign 2 N 3 C

In an exemplary embodiment, the virtual address must be aligned, thatis, it must be an exact multiple of the operand size expressed in bytes.If the address is not aligned an “access disallowed by virtual address”exception occurs.

In an exemplary embodiment, Z (zero) rounding is not defined forunsigned extract operations, and a ReservedInstruction exception israised if attempted. F (floor) rounding will properly round unsignedresults downward.

As shown in FIG. 15C, an exemplary embodiment of awide-multiply-matrix-extract-doublets instruction (W.MUL.MAT.X.B orW.MUL.MAT.X.L) multiplies memory [m63 m62 m6 . . . m2 m1 m0] with vector[h g f e d c b a], yielding the products

[am7+bm15+cm23+dm31+em39+fm47+gm55+hm63 . . .

am2+bm10+cm18+dm26+em34+fm42+gm50+hm58am1+bm9+cm17+dm25+em33+fm41+gm49+hm57am0+bm8+cm16+dm24+em32+fm40+gm48+hm56], rounded and limited asspecified.

As shown in FIG. 15D, an exemplary embodiment of awide-multiply-matrix-extract-complex-doublets instruction (W.MUL.MAT.Xwith n set in rb) multiplies memory [m31 m30 m29 . . . m2 m1 m0] withvector [h g f e d c b a], yielding the products[am7+bm6+cm15+dm14+em23+fm22+gm31+hm30 . . .am2−bm3+cm10−dm11+em18−fm19+gm26−hm27am1+bm0+cm9+dm8+em17+fm16+gm25+hm24 am0−bm1+cm8−dm9+em16−fm17+gm24hm25], rounded and limited as specified.

An exemplary embodiment of the pseudocode 1580 of the Wide MultiplyMatrix Extract instruction is shown in FIG. 15E. An exemplary embodimentof the exceptions 1590 of the Wide Multiply Matrix Extract instructionis shown in FIG. 15F.

Wide Multiply Matrix Extract Immediate

An exemplary embodiment of the Wide Multiply Matrix Extract Immediateinstruction is shown in FIGS. 16A-16E. In an exemplary embodiment, theWide Multiply Matrix Extract Immediate instructions perform the samefunction as above, except that the extraction, operand format and sizeis controlled by fields in the instruction. This form encodes commonforms of the above instruction without the need to initialize a registerwith the required control information. Controls within the instructionallow specification of signed, mixed signed, unsigned, and complexoperands.

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, a second operandfrom a general register, perform a group of operations on partitions ofbits in the operands, and catenate the results together, placing theresult in a general register. An exemplary embodiment of the format 1610of the Wide Multiply Matrix Extract Immediate instruction is shown inFIG. 16A.

An exemplary embodiment of the schematics 1630 and 1660 of the WideMultiply Matrix Extract Immediate instruction is shown in FIGS. 16B and16C. In an exemplary embodiment, the contents of register rc is used asa virtual address, and a value of specified size is loaded from memory.A second value is the contents of register rb. The values arepartitioned into groups of operands of the size specified and aremultiplied and summed in columns, producing a group of sums. The groupof sums is rounded, limited, and extracted as specified, yielding agroup of results, each of which is the size specified. The group ofresults is catenated and placed in register rd. All results are signed,N (nearest) rounding is used, and all results are limited to maximumrepresentable signed values.

In an exemplary embodiment, the wide-multiply-extract-immediate-matrixinstructions (W.MUL.MAT.X.I, W.MUL.MAT.X.I.C) perform a partitionedarray multiply of up to 16384 bits, that is 128×128 bits. The width ofthe array can be limited to 128, 64, 32, or 16 bits, but not smallerthan twice the group size, by adding one-half the desired size in bytesto the virtual address operand: 8, 4, 2, or 1. The array can be limitedvertically to 128, 64, 32, or 16 bits, but not smaller than twice thegroup size, by adding one half the desired memory operand size in bytesto the virtual address operand.

In an exemplary embodiment, the virtual address must either be alignedto 2048/gsize bytes (or 1024/gsize for W.ML.MAT.X.I.C), or must be thesum of an aligned address and one-half of the size of the memory operandin bytes and/or one half of the size of the result in bytes. An alignedaddress must be an exact multiple of the size expressed in bytes. If theaddress is not valid an “access disallowed by virtual address” exceptionoccurs.

As shown in FIG. 16B, an exemplary embodiment of awide-multiply-extract-immediate-matrix-doublets instruction(W.MUL.MAT.X.I.16) multiplies memory [m63 m62 m61 . . . m2 m1 m0] withvector [h g f e d c b a], yielding the products

[am7+bm15+cm23+dm31+em39+fm47+gm55+hm63 . . .

am2+bm10+cm18+dm26+em34+fm42+gm50+hm58

am1+bm9+cm17+dm25+em33+fm41+gm49+hm57am0+bm8+cm16+dm24+em32+fm40+gm48+hm56], rounded and limited asspecified.

As shown in FIG. 16C, an exemplary embodiment of awide-multiply-matrix-extract-immediate-complex-doublets instruction(W.MUL.MAT.X.I.C.16) multiplies memory [m31 m30 m29 . . . m2 m1 m0] withvector [h g f e d c b a], yielding the products[am7+bm6+cm15+dm14+em23+fm22+gm31+hm30 . . .am2−bm3+cm10−dm11+em18−fm19+gm26−hm27am1+bm0+cm9+dm8+em17+fm16+gm25+hm24am0−bm1+cm8−dm9+em16−fm17+gm24−hm25], rounded and limited as specified.

An exemplary embodiment of the pseudocode 1680 of the Wide MultiplyMatrix Extract Immediate instruction is shown in FIG. 16D. An exemplaryembodiment of the exceptions 1590 of the Wide Multiply Matrix ExtractImmediate instruction is shown in FIG. 16E.

Wide Multiply Matrix Floating-Point

An exemplary embodiment of the Wide Multiply Matrix Floating-pointinstruction is shown in FIGS. 17A-17E. In an exemplary embodiment, theWide Multiply Matrix Floating-point instructions perform a matrixmultiply in the same form as above, except that the multiplies andadditions are performed in floating-point arithmetic. Sizes of half(16-bit), single (32-bit), double (64-bit), and complex sizes of half,single and double can be specified within the instruction.

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, a second operandfrom a general register, perform a group of operations on partitions ofbits in the operands, and catenate the results together, placing theresult in a general register. An exemplary embodiment of the format 1710of the Wide Multiply Matrix Floating point instruction is shown in FIG.17A.

An exemplary embodiment of the schematics 1730 and 1760 of the WideMultiply Matrix Floating-point instruction is shown in FIGS. 17B and17C. In an exemplary embodiment, the contents of register rc is used asa virtual address, and a value of specified size is loaded from memory.A second value is the contents of register rb. The values arepartitioned into groups of operands of the size specified. The secondvalues are multiplied with the first values, then summed, producing agroup of result values. The group of result values is catenated andplaced in register rd.

In an exemplary embodiment, the wide-multiply-matrix-floating-pointinstructions (W.MUL.MAT.F, W.MUL.MAT.C.F) perform a partitioned arraymultiply of up to 16384 bits, that is 128×128 bits. The width of thearray can be limited to 128, 64, 32 bits, but not smaller than twice thegroup size, by adding one-half the desired size in bytes to the virtualaddress operand: 8, 4, or 2. The array can be limited vertically to 128,64, 32, or 16 bits, but not smaller than twice the group size, by addingone-half the desired memory operand size in bytes to the virtual addressoperand.

In an exemplary embodiment, the virtual address must either be alignedto 2048/gsize bytes (or 1024/gsize for W.MUL.MAT.C.F), or must be thesum of an aligned address and one half of the size of the memory operandin bytes and/or one-half of the size of the result in bytes. An alignedaddress must be an exact multiple of the size expressed in bytes. If theaddress is not valid an “access disallowed by virtual address” exceptionoccurs.

As shown in FIG. 17B, an exemplary embodiment of awide-multiply-matrix-floating-point-half instruction (W.MUL.MAT.F)multiplies memory [m31 m30 . . . m1 m0] with vector [h g f e d c b a],yielding products [hm31+gm27+ . . . +bm7+am3 . . . hm28+gm24+ . . .+bm4+am0].

As shown in FIG. 17C, an exemplary embodiment of awide-multiply-matrix-complex-floating-point-half instruction(W.MUL.MAT.F) multiplies memory [m15 m14 . . . m1 m0] with vector [h g fe d c b a], yielding products [hm14+gm15+ . . . +bm2+am3 . . .hm12+gm13+ . . . +bm0+am1−hm13+gm12+ . . . −bm1+am0].

An exemplary embodiment of the pseudocode 1780 of the Wide MultiplyMatrix Floating-point instruction is shown in FIG. 17D. Additionalpseudocode functions used by this and other floating point instructionsis shown in Figure FLOAT-1. An exemplary embodiment of the exceptions1790 of the Wide Multiply Matrix Floating-point instruction is shown inFIG. 17E.

Wide Multiply Matrix Galois

An exemplary embodiment of the Wide Multiply Matrix Galois instructionis shown in FIGS. 18A-18D. In an exemplary embodiment, the Wide MultiplyMatrix Galois instructions perform a matrix multiply in the same form asabove, except that the multiples and additions are performed in Galoisfield arithmetic. A size of 8 bits can be specified within theinstruction. The contents of a general register specify the polynomialwith which to perform the Galois field remainder operation. The natureof the matrix multiplication is novel and described in detail below.

In an exemplary embodiment, these instructions take an address from ageneral register to fetch a large operand from memory, second and thirdoperands from general registers, perform a group of operations onpartitions of bits in the operands, and catenate the results together,placing the result in a general register. An exemplary embodiment of theformat 1810 of the Wide Multiply Matrix Galois instruction is shown inFIG. 18A.

An exemplary embodiment of the schematic 1830 of the Wide MultiplyMatrix Galois instruction is shown in FIG. 18B. In an exemplaryembodiment, the contents of register re is used as a virtual address,and a value of specified size is loaded from memory. Second and thirdvalues are the contents of registers rd and rb. The values arepartitioned into groups of operands of the size specified. The secondvalues are multiplied as polynomials with the first value, producing aresult which is reduced to the Galois field specified by the thirdvalue, producing a group of result values. The group of result values iscatenated and placed in register ra.

In an exemplary embodiment, the wide-multiply-matrix-Galois-bytesinstruction (W.MUL.MAT.G.8) performs a partitioned array multiply of upto 16384 bits, that is 128×128 bits. The width of the array can belimited to 128, 64, 32, or 16 bits, but not smaller than twice the groupsize of 8 bits, by adding one-half the desired size in bytes to thevirtual address operand: 8, 4, 2, or 1. The array can be limitedvertically to 128, 64, 32, or 16 bits, but not smaller than twice thegroup size of 8 bits, by adding one-half the desired memory operand sizein bytes to the virtual address operand.

In an exemplary embodiment, the virtual address must either be alignedto 256 bytes, or must be the sum of an aligned address and one-half ofthe size of the memory operand in bytes and/or one-half of the size ofthe result in bytes. An aligned address must be an exact multiple of thesize expressed in bytes. If the address is not valid an “accessdisallowed by virtual address” exception occurs.

As shown in FIG. 18B, an exemplary embodiment of awide-multiply-matrix-Galois-byte instruction (W.MUL.MAT.G.8) multipliesmemory [m255 m254 . . . m1 m0] with vector [p o n m l k j i h g f e d cb a], reducing the result modulo polynomial [q], yielding products[(pm255+om247+ . . . +bm31+am15 mod q) (pm254+om246+ . . . +bm30+am14mod q) . . . (pm248+om240+ . . . +bm16+am0 mod q)].

An exemplary embodiment of the pseudocode 1860 of the Wide MultiplyMatrix Galois instruction is shown in FIG. 18C. An exemplary embodimentof the exceptions 1890 of the Wide Multiply Matrix Galois instruction isshown in FIG. 18D.

Memory Operands of Either Little-Endian or Big-Endian Conventional ByteOrdering

In another aspect of the invention, memory operands of eitherlittle-endian or big-endian conventional byte ordering are facilitated.Consequently, all Wide operand instructions are specified in two forms,one for little-endian byte ordering and one for big-endian byteordering, as specified by a portion of the instruction. The byte orderspecifies to the memory system the order in which to deliver the byteswithin units of the data path width (128 bits), as well as the order toplace multiple memory words (128 bits) within a larger Wide operand.

Extraction of a High Order Portion of a Multiplier Product or Sum ofProducts

Another aspect of the present invention addresses extraction of a highorder portion of a multiplier product or sum of products, as a way ofefficiently utilizing a large multiplier array. Related U.S. Pat. No.5,742,840 and U.S. Pat. No. 5,953,241 describe a system and method forenhancing the utilization of a multiplier array by adding specificclasses of instructions to a general-purpose processor. This addressesthe problem of making the most use of a large multiplier array that isfully used for high-precision arithmetic—for example a 64×64 bitmultiplier is fully used by a 64-bit by 64-bit multiply, but only onequarter used for a 32-bit by 32-bit multiply) for (relative to themultiplier data width and registers) low-precision arithmeticoperations. In particular, operations that perform a great manylow-precision multiplies which are combined (added) together in variousways are specified. One of the overriding considerations in selectingthe set of operations is a limitation on the size of the result operand.In an exemplary embodiment, for example, this size might be limited toon the order of 128 bits, or a single register, although no specificsize limitation need exist.

The size of a multiply result, a product, is generally the sum of thesizes of the operands, multiplicands and multiplier. Consequently,multiply instructions specify operations in which the size of the resultis twice the size of identically-sized input operands. For our prior artdesign, for example, a multiply instruction accepted two 64-bit registersources and produces a single 128-bit register-pair result, using anentire 64×64 multiplier array for 64-bit symbols, or half the multiplierarray for pairs of 32-bit symbols, or one quarter the multiplier arrayfor quads of 16-bit symbols. For all of these cases, note that tworegister sources of 64 bits are combined, yielding a 128-bit result.

In several of the operations, including complex multiplies, convolve,and matrix multiplication, low-precision multiplier products are addedtogether. The additions further increase the required precision. The sumof two products requires one additional bit of precision; adding fourproducts requires two, adding eight products requires three, addingsixteen products requires four. In some prior designs, some of thisprecision is lost, requiring scaling of the multiplier operands to avoidoverflow, further reducing accuracy of the result.

The use of register pairs creates an undesirable complexity, in thatboth the register pair and individual register values must be bypassedto subsequent instructions. As a result, with prior art techniques onlyhalf of the source operand 128-bit register values could be employedtoward producing a single-register 128-bit result.

In the present invention, a high-order portion of the multiplier productor sum of products is extracted, adjusted by a dynamic shift amount froma general register or an adjustment specified as part of theinstruction, and rounded by a control value from a register orinstruction portion as round-to-nearest/even, toward zero, floor, orceiling. Overflows are handled by limiting the result to the largest andsmallest values that can be accurately represented in the output result.

Extract Controlled by a Register

In the present invention, when the extract is controlled by a register,the size of the result can be specified, allowing rounding and limitingto a smaller number of bits than can fit in the result. This permits theresult to be scaled to be used in subsequent operations without concernof overflow or rounding, enhancing performance.

Also in the present invention, when the extract is controlled by aregister, a single register value defines the size of the operands, theshift amount and size of the result, and the rounding control. Byplacing all this control information in a single register, the size ofthe instruction is reduced over the number of bits that such ainstruction would otherwise require, improving performance and enhancingflexibility of the processor.

The particular instructions included in this aspect of the presentinvention are Ensemble Convolve Extract, Ensemble Multiply Extract,Ensemble Multiply Add Extract and Ensemble Scale Add Extract.

Ensemble Extract Inplace

An exemplary embodiment of the Ensemble Extract Inplace instruction isshown in FIGS. 19A-19G. In an exemplary embodiment, several of theseinstructions (Ensemble Convolve Extract, Ensemble Multiply Add Extract)are typically available only in forms where the extract is specified aspart of the instruction. An alternative embodiment can incorporate formsof the operations in which the size of the operand, the shift amount andthe rounding can be controlled by the contents of a general register (asthey are in the Ensemble Multiply Extract instruction). The definitionof this kind of instruction for Ensemble Convolve Extract, and EnsembleMultiply Add Extract would require four source registers, whichincreases complexity by requiring additional general-register readports.

In an exemplary embodiment, these operations take operands from fourregisters, perform operations on partitions of bits in the operands, andplace the concatenated results in a fourth register. An exemplaryembodiment of the format and operation codes 1910 of the EnsembleExtract Inplace instruction is shown in FIG. 19A.

An exemplary embodiment of the schematics 1930, 1945, 1960, and 1975 ofthe Ensemble Extract Inplace instruction is shown in FIGS. 19C, 19D,19E, and 19F. In an exemplary embodiment, the contents of registers rd,rc, rb, and ra are fetched. The specified operation is performed onthese operands. The result is placed into register rd.

In an exemplary embodiment, for the E.CON.X instruction, the contents ofregisters rd and rc are catenated, as c∥d, and used as a first value. Asecond value is the contents of register rb. The values are partitionedinto groups of operands of the size specified and are convolved,producing a group of values. The group of values is rounded, limited andextracted as specified, yielding a group of results that is the sizespecified. The group of results is catenated and placed in register rd.

In an exemplary embodiment, for the E.MUL.ADD.X instruction, thecontents of registers rc and rb are partitioned into groups of operandsof the size specified and are multiplied, producing a group of values towhich are added the partitioned and extended contents of register rd.The group of values is rounded, limited and extracted as specified,yielding a group of results that is the size specified. The group ofresults is catenated and placed in register rd.

As shown in FIG. 19B, in an exemplary embodiment, bits 31 . . . 0 of thecontents of register ra specifies several parameters that control themanner in which data is extracted, and for certain operations, themanner in which the operation is performed. The position of the controlfields allows for the source position to be added to a fixed controlvalue for dynamic computation, and allows for the lower 16 bits of thecontrol field to be set for some of the simpler extract cases by asingle GCOPYI.128 instruction. The control fields are further arrangedso that if only the low order 8 bits are non-zero, a 128-bit extractionwith truncation and no rounding is performed.

In an exemplary embodiment, the table below describes the meaning ofeach label:

label bits meaning fsize 8 field size dpos 8 destination position x 1extended vs. group size result s 1 signed vs. unsigned n 1 complex vs.real multiplication m 1 mixed-sign vs. same-sign multiplication l 1limit: saturation vs. truncation rnd 2 rounding gssp 9 group size andsource position

In an exemplary embodiment, the 9-bit gssp field encodes both the groupsize, gsize, and source position, spos, according to the formulagssp=512−4*gsize+spos. The group size, gsize, is a power of two in therange 1 . . . 128. The source position, spos, is in the range 0 . . .(2*gsize)−1.

In an exemplary embodiment, the values in the x, s, n, m, l, and rndfields have the following meaning:

values x s n m l rnd 0 group unsigned real same-sign truncate F 1extended signed complex mixed-sign saturate Z 2 N 3 C

Ensemble Multiply Add Extract

As shown in FIG. 19C, an exemplary embodiment of anensemble-multiply-add-extract-doublets instruction (E.MULADDX)multiplies vector rc [h g f e d c b a] with vector rb [p o n m l k j i],and adding vector rd [x w v u t s r q], yielding the result vector rd[hp+x go+w fn+v em+u dl+t ck+s bj+r ai+q], rounded and limited asspecified by ra31 . . . 0.

As shown in FIG. 19D, an exemplary embodiment of anensemble-multiply-add-extract-doublets-complex instruction (E.MUL.X withn set) multiplies operand vector rc [h g f e d c b a] by operand vectorrb [p o n m l k j i], yielding the result vector rd [gp+ho go−hp en+fmem−fn cl+dk ck−dl aj+bi ai−bj], rounded and limited as specified by ra31. . . 0. Note that this instruction prefers an organization of complexnumbers in which the real part is located to the right (lower precision)of the imaginary part.

Ensemble Convolve Extract

As shown in FIG. 19E, an exemplary embodiment of anensemble-convolve-extract-doublets instruction (ECON.X with n=0)convolves vector rc∥rd [x w v u t s r q p o n m l k j i] with vector rb[h g f e d c b a], yielding the products vector rd

[ax+bw+cv+du+et+fs+gr+hq . . . as+br+cq+dp+eo+fn+gm+hl

ar+bq+cp+do+en+fm+gl+hk aq+bp+co+dn+em+fl+gk+hj], rounded and limited asspecified by ra_(31 . . . 0).

As shown in FIG. 19F, an exemplary embodiment of anensemble-convolve-extract-complex-doublets instruction (ECON.X with n=1)convolves vector rd∥rc [x w v u t s r q p o n m l k j i] with vector rb[h i g f e d c b a], yielding the products vector rd

[ax+bw+cv+du+et+fs+gr+hq . . . as−bt+cq−dr+eo−fp+gm−hnar+bq+cp+do+en+fm+gl+hk aq−br+co−dp+em−fn+gk+hl], rounded and limited asspecified by ra31 . . . 0.

An exemplary embodiment of the pseudocode 1990 of Ensemble ExtractInplace instruction is shown in FIG. 19G. In an exemplary embodiment,there are no exceptions for the Ensemble Extract Inplace instruction.

Ensemble Extract

An exemplary embodiment of the Ensemble Extract instruction is shown inFIGS. 20A-20J. In an exemplary embodiment, these operations takeoperands from three registers, perform operations on partitions of bitsin the operands, and place the catenated results in a fourth register.An exemplary embodiment of the format and operation codes 2010 of theEnsemble Extract instruction is shown in FIG. 20A.

An exemplary embodiment of the schematics 2020, 2030, 2040, 2050, 2060,2070, and 2080 of the Ensemble Extract Inplace instruction is shown inFIGS. 20C, 20D, 20E, 20F, 20G, 20H, and 201. In an exemplary embodiment,the contents of registers rd, rc, and rb are fetched. The specifiedoperation is performed on these operands. The result is placed intoregister ra.

As shown in FIG. 20B, in an exemplary embodiment, bits 31 . . . 0 of thecontents of register rb specifies several parameters that control themanner in which data is extracted, and for certain operations, themanner in which the operation is performed. The position of the controlfields allows for the source position to be added to a fixed controlvalue for dynamic computation, and allows for the lower 16 bits of thecontrol field to be set for some of the simpler extract cases by asingle GCOPYI.128 instruction. The control fields are further arrangedso that if only the low order 8 bits are non-zero, a 128-bit extractionwith truncation and no rounding is performed.

In an exemplary embodiment, the table below describes the meaning ofeach label:

label bits meaning fsize 8 field size dpos 8 destination position x 1extended vs. group size result s 1 signed vs. unsigned n 1 complex vs.real multiplication m 1 merge vs. extract or mixed-sign vs. same-signmultiplication l 1 limit: saturation vs. truncation rnd 2 rounding gssp9 group size and source position

In an exemplary embodiment, the 9-bit gssp field encodes both the groupsize, gsize, and source position, spos, according to the formulagssp=512 4*gsize+spos. The group size, gsize, is a power of two in therange 1 . . . 128. The source position, spos, is in the range 0 . . .(2*gsize)−1.

In an exemplary embodiment, the values in the x, s, n, m, l, and rndfields have the following meaning:

values x s n m l rnd 0 group unsigned real extract/same- truncate F sign1 extended signed complex merge/ saturate Z mixed-sign 2 N 3 C

In an exemplary embodiment, for the E.SCAL.ADD.X instruction, bits 127 .. . 64 of the contents of register rb specifies the multipliers for themultiplicands in registers rd and rc. Specifically, bits 64+2*gsize−1 .. . 64+gsize is the multiplier for the contents of register rd, and bits64+gsize−1 . . . 64 is the multiplier for the contents of register rc.

Ensemble Multiply Extract

As shown in FIG. 20C, an exemplary embodiment of anensemble-multiply-extract-doublets instruction (E.MULX) multipliesvector rd [h g f e d c b a] with vector rc [p o n m l k j i], yieldingthe result vector ra [hp go fn em dl ck bj ai], rounded and limited asspecified by rb_(31 . . . 0).

As shown in FIG. 20D, an exemplary embodiment of anensemble-multiply-extract-doublets-complex instruction (E.MUL.X with nset) multiplies vector rd [h g f e d c b a] by vector rc [p o n m l k ji], yielding the result vector ra [gp+ho go−hp en+fm em−fn cl+dk ck−dlaj+bi ai−bj], rounded and limited as specified by rb_(31 . . . 0). Notethat this instruction prefers an organization of complex numbers inwhich the real part is located to the right (lower precision) of theimaginary part.

Ensemble Scale Add Extract

An aspect of the present invention defines the Ensemble Scale AddExtract instruction, that combines the extract control information in aregister along with two values that are used as scalar multipliers tothe contents of two vector multiplicands.

This combination reduces the number of registers that would otherwise berequired, or the number of bits that the instruction would otherwiserequire, improving performance. Another advantage of the presentinvention is that the combined operation may be performed by anexemplary embodiment with sufficient internal precision on the summationnode that no intermediate rounding or overflow occurs, improving theaccuracy over prior art operation in which more than one instruction isrequired to perform this computation.

As shown in FIG. 20E, an exemplary embodiment of anensemble-scale-add-extract-doublets instruction (E.SCAL.ADD.X)multiplies vector rd [h g f e d c b a] with rb_(95 . . . 80) [r] andadds the product to the product of vector rc [p o n m l k j i] withrb_(79 . . . 64) [q], yielding the result [hr+pq gr+oq fr+nq er+mq dr+lqcr+kq br+jq ar+iq], rounded and limited as specified by rb_(31 . . . 0).

As shown in FIG. 20F, an exemplary embodiment of anensemble-scale-add-extract-doublets-complex instruction (E.SCLADD.X withn set) multiplies vector rd [h g f e d c b a] with rb_(127 . . . 96) [ts] and adds the product to the product of vector rc [p o n m l k j i]with rb_(95 . . . 64) [r q], yielding the result [hs+gt+pq+orgs−ht+oq−pr fs+et+nq+mr es−ft+mq−nr ds+ct+lq+kr cs−dt+kq−lr bs+at+jq+iras−bt+iq−jr], rounded and limited as specified by rb_(31 . . . 0).

Ensemble Extract

As shown in FIG. 20G, in an exemplary embodiment, for the E.EXTRACTinstruction, when m=0 and x=0, the parameters specified by the contentsof register rb are interpreted to select fields from double size symbolsof the catenated contents of registers rd and rc, extracting valueswhich are catenated and placed in register ra.

As shown in FIG. 20H, in an exemplary embodiment, for anensemble-merge-extract (E.EXTRACT when m=1), the parameters specified bythe contents of register rb are interpreted to merge fields from symbolsof the contents of register rd with the contents of register rc. Theresults are catenated and placed in register ra. The x field has noeffect when m=1.

As shown in FIG. 20I, in an exemplary embodiment, for anensemble-expand-extract (E.EXTRACT when m=0 and x=1), the parametersspecified by the contents of register rb are interpreted to extractfields from symbols of the contents of register rd. The results arecatenated and placed in register ra. Note that the value of re is notused.

An exemplary embodiment of the pseudocode 2090 of Ensemble Extractinstruction is shown in FIG. 20J. In an exemplary embodiment, there areno exceptions for the Ensemble Extract instruction.

Reduction of Register Read Ports

Another alternative embodiment can reduce the number of register readports required for implementation of instructions in which the size,shift and rounding of operands is controlled by a register. The value ofthe extract control register can be fetched using an additional cycle onan initial execution and retained within or near the functional unit forsubsequent executions, thus reducing the amount of hardware required forimplementation with a small additional performance penalty. The valueretained would be marked invalid, causing a re-fetch of the extractcontrol register, by instructions that modify the register, oralternatively, the retained value can be updated by such an operation. Are-fetch of the extract control register would also be required if adifferent register number were specified on a subsequent execution. Itshould be clear that the properties of the above two alternativeembodiments can be combined.

Galois Field Arithmetic

Another aspect of the invention includes Galois field arithmetic, wheremultiplies are performed by an initial binary polynomial multiplication(unsigned binary multiplication with carries suppressed), followed by apolynomial modulo/remainder operation (unsigned binary division withcarries suppressed). The remainder operation is relatively expensive inarea and delay. In Galois field arithmetic, additions are performed bybinary addition with carries suppressed, or equivalently, a bitwiseexclusive or operation. In this aspect of the present invention, amatrix multiplication is performed using Galois field arithmetic, wherethe multiplies and additions are Galois field multiples and additions.

Using prior art methods, a 16 byte vector multiplied by a 16×16 bytematrix can be performed as 256 8-bit Galois field multiplies and16*15=240 8-bit Galois field additions. Included in the 256 Galois fieldmultiplies are 256 polynomial multiplies and 256 polynomial remainderoperations.

By use of the present invention, the total computation is reducedsignificantly by performing 256 polynomial multiplies, 240 16-bitpolynomial additions, and 16 polynomial remainder operations. Note thatthe cost of the polynomial additions has been doubled compared with theGalois field additions, as these are now 16-bit operations rather than8-bit operations, but the cost of the polynomial remainder functions hasbeen reduced by a factor of 16. Overall, this is a favorable tradeoff,as the cost of addition is much lower than the cost of remainder.

Decoupled Access from Execution Pipelines and SimultaneousMultithreading

In yet another aspect of the present invention, best shown in FIG. 4,the present invention employs both decoupled access from executionpipelines and simultaneous multithreading in a unique way. SimultaneousMultithreaded pipelines have been employed in prior art to enhance theutilization of data path units by allowing instructions to be issuedfrom one of several execution threads to each functional unit (e.g. DeanM. Tullsen, Susan J. Eggers, and Henry M. Levy, “SimultaneousMultithreading: Maximizing On Chip Parallelism,” Proceedings of the 22ndAnnual International Symposium on Computer Architecture, SantaMargherita Ligure, Italy, June, 1995).

Decoupled access from execution pipelines have been employed in priorart to enhance the utilization of execution data path units by bufferingresults from an access unit, which computes addresses to a memory unitthat in turn fetches the requested items from memory, and thenpresenting them to an execution unit (e.g. J. E. Smith, “DecoupledAccess/Execute Computer Architectures”, Proceedings of the Ninth AnnualInternational Symposium on Computer Architecture, Austin, Tex. (April 2629, 1982), pp. 112-119).

Compared to conventional pipelines, the Eggers prior art used anadditional pipeline cycle before instructions could be issued tofunctional units, the additional cycle needed to determine which threadsshould be permitted to issue instructions. Consequently, relative toconventional pipelines, the prior art design had additional delay,including dependent branch delay.

The present invention contains individual access data path units, withassociated register files, for each execution thread. These access unitsproduce addresses, which are aggregated together to a common memoryunit, which fetches all the addresses and places the memory contents inone or more buffers. Instructions for execution units, which are sharedto varying degrees among the threads are also buffered for laterexecution. The execution units then perform operations from all activethreads using functional data path units that are shared.

For instructions performed by the execution units, the extra cyclerequired for prior art simultaneous multithreading designs is overlappedwith the memory data access time from prior art decoupled access fromexecution cycles, so that no additional delay is incurred by theexecution functional units for scheduling resources. For instructionsperformed by the access units, by employing individual access units foreach thread the additional cycle for scheduling shared resources is alsoeliminated.

This is a favorable tradeoff because, while threads do not share theaccess functional units, these units are relatively small compared tothe execution functional units, which are shared by threads.

With regard to the sharing of execution units, the present inventionemploys several different classes of functional units for the executionunit, with varying cost, utilization, and performance. In particular,the G units, which perform simple addition and bitwise operations isrelatively inexpensive (in area and power) compared to the other units,and its utilization is relatively high. Consequently, the design employsfour such units, where each unit can be shared between two threads. TheX unit, which performs a broad class of data switching functions is moreexpensive and less used, so two units are provided that are each sharedamong two threads. The T unit, which performs the Wide Translateinstruction, is expensive and utilization is low, so the single unit isshared among all four threads. The E unit, which performs the class ofEnsemble instructions, is very expensive in area and power compared tothe other functional units, but utilization is relatively high, so weprovide two such units, each unit shared by two threads.

In FIG. 4, four copies of an access unit are shown, each with an accessinstruction fetch queue A-Queue 401-404, coupled to an access registerfile AR 405-408, each of which is, in turn, coupled to two accessfunctional units A 409-416. The access units function independently forfour simultaneous threads of execution. These eight access functionalunits A 409-416 produce results for access register files AR 405-408 andaddresses to a shared memory system 417. The memory contents fetchedfrom memory system 417 are combined with execute instructions notperformed by the access unit and entered into the four executeinstruction queues E-Queue 421-424. Instructions and memory data fromE-queue 421-424 are presented to execution register files 425-428, whichfetches execution register file source operands. The instructions arecoupled to the execution unit arbitration unit Arbitration 431, thatselects which instructions from the four threads are to be routed to theavailable execution units E 441 and 449, X 442 and 448, G 443-444 and446-447, and T 445. The execution register file source operands ER425-428 are coupled to the execution units 441-445 using source operandbuses 451-454 and to the execution units 445-449 using source operandbuses 455-458. The function unit result operands from execution units441-445 are coupled to the execution register file using result bus 461and the function units result operands from execution units 445-449 arecoupled to the execution register file using result bus 462.

Improved Interprivilege Gateway

In a still further aspect of the present invention, an improvedinterprivilege gateway is described which involves increased parallelismand leads to enhanced performance. In related U.S. patent applicationSer. No. 08/541,416, a system and method is described for implementingan instruction that, in a controlled fashion, allows the transfer ofcontrol (branch) from a lower privilege level to a higher privilegelevel. The present invention is an improved system and method for amodified instruction that accomplishes the same purpose but withspecific advantages.

Many processor resources, such as control of the virtual memory systemitself, input and output operations, and system control functions areprotected from accidental or malicious misuse by enclosing them in aprotective, privileged region. Entry to this region must be establishedonly though particular entry points, called gateways, to maintain theintegrity of these protected regions.

Prior art versions of this operation generally load an address from aregion of memory using a protected virtual memory attribute that is onlyset for data regions that contain valid gateway entry points, thenperform a branch to an address contained in the contents of memory.Basically, three steps were involved: load, then branch and check.Compared to other instructions, such as register to register computationinstructions and memory loads and stores, and register based branches,this is a substantially longer operation, which introduces delays andcomplexity to a pipelined implementation.

In the present invention, the branch-gateway instruction performs twooperations in parallel: 1) a branch is performed to the Contents ofregister 0 and 2) a load is performed using the contents of register 1,using a specified byte order (little-endian) and a specified size (64bits). If the value loaded from memory does not equal the contents ofregister 0, the instruction is aborted due to an exception. In addition,3) a return address (the next sequential instruction address followingthe branch-gateway instruction) is written into register 0, provided theinstruction is not aborted. This approach essentially uses a firstinstruction to establish the requisite permission to allow user code toaccess privileged code, and then a second instruction is permitted tobranch directly to the privileged code because of the permissions issuedfor the first instruction.

In the present invention, the new privilege level is also contained inregister 0, and the second parallel operation does not need to beperformed if the new privilege level is not greater than the oldprivilege level. When this second operation is suppressed, the remainderof the instruction performs an identical function to a branch-linkinstruction, which is used for invoking procedures that do not requirean increase in privilege. The advantage that this feature brings is thatthe branch-gateway instruction can be used to call a procedure that mayor may not require an increase in privilege.

The memory load operation verifies with the virtual memory system thatthe region that is loaded has been tagged as containing valid gatewaydata. A further advantage of the present invention is that the calledprocedure may rely on the fact that register 1 contains the address thatthe gateway data was loaded from, and can use the contents of register 1to locate additional data or addresses that the procedure may require.Prior art versions of this instruction required that an additionaladdress be loaded from the gateway region of memory in order toinitialize that address in a protected manner—the present inventionallows the address itself to be loaded with a “normal” load operationthat does not require special protection.

The present invention allows a “normal” load operation to also load thecontents of register 0 prior to issuing the branch-gateway instruction.The value may be loaded from the same memory address that is loaded bythe branch-gateway instruction, because the present invention contains avirtual memory system in which the region may be enabled for normal loadoperations as well as the special “gateway” load operation performed bythe branch-gateway instruction.

Improved Interprivilege Gateway—System and Privileged Library Calls

An exemplary embodiment of the System and Privileged Library Calls isshown in FIGS. 21A-21 B. An exemplary embodiment of the schematic 2110of System and Privileged Library Calls is shown in FIG. 21A. In anexemplary embodiment, it is an objective to make calls to systemfacilities and privileged libraries as similar as possible to normalprocedure calls as described above. Rather than invoke system calls asan exception, which involves significant latency and complication, amodified procedure call in which the process privilege level is quietlyraised to the required level is used. To provide this mechanism safely,interaction with the virtual memory system is required.

In an exemplary embodiment, such a procedure must not be entered fromanywhere other than its legitimate entry point, to prohibit entering aprocedure after the point at which security checks are performed or withinvalid register contents, otherwise the access to a higher privilegelevel can lead to a security violation. In addition, the proceduregenerally must have access to memory data, for which addresses must beproduced by the privileged code. To facilitate generating theseaddresses, the branch-gateway instruction allows the privileged codeprocedure to rely on the fact that a single register has been verifiedto contain a pointer to a valid memory region.

In an exemplary embodiment, the branch-gateway instruction ensures boththat the procedure is invoked at a proper entry point, and that otherregisters such as the data pointer and stack pointer can be properlyset. To ensure this, the branch-gateway instruction retrieves a“gateway” directly from the protected virtual memory space. The gatewaycontains the virtual address of the entry point of the procedure and thetarget privilege level. A gateway can only exist in regions of thevirtual address space designated to contain them, and can only be usedto access privilege levels at or below the privilege level at which thememory region can be written to ensure that a gateway cannot be forged.

In an exemplary embodiment, the branch-gateway instruction ensures thatregister 1 (dp) contains a valid pointer to the gateway for this targetcode address by comparing the contents of register 0 (lp) against thegateway retrieved from memory and causing an exception trap if they donot match. By ensuring that register 1 points to the gateway, auxiliaryinformation, such as the data pointer and stack pointer can be set byloading values located by the contents of register 1. For example, theeight bytes following the gateway may be used as a pointer to a dataregion for the procedure.

In an exemplary embodiment, before executing the branch-gatewayinstruction, register 1 must be set to point at the gateway, andregister 0 must be set to the address of the target code address plusthe desired privilege level. A “L.I.64.L.A r0=r1,0” instruction is oneway to set register 0, if register 1 has already been set, but any meansof getting the correct value into register 0 is permissible.

In an exemplary embodiment, similarly, a return from a system orprivileged routine involves a reduction of privilege. This need not becarefully controlled by architectural facilities, so a procedure mayfreely branch to a less-privileged code address. Normally, such aprocedure restores the stack frame, then uses the branch-downinstruction to return.

An exemplary embodiment of the typical dynamic-linked, inter-gatewaycalling sequence 2130 is shown in FIG. 21B. In an exemplary embodiment,the calling sequence is identical to that of the inter-module callingsequence shown above, except for the use of the B.GATE instructioninstead of a B.LINK instruction. Indeed, if a B.GATE instruction is usedwhen the privilege level in the lp register is not higher than thecurrent privilege level, the B.GATE instruction performs an identicalfunction to a B.LINK.

In an exemplary embodiment, the callee, if it uses a stack for localvariable allocation, cannot necessarily trust the value of the sp passedto it, as it can be forged. Similarly, any pointers which the calleeprovides should not be used directly unless it they are verified topoint to regions which the callee should be permitted to address. Thiscan be avoided by defining application programming interfaces (APIs) inwhich all values are passed and returned in registers, or by using atrusted, intermediate privilege wrapper routine to pass and returnparameters. The method described below can also be used.

In an exemplary embodiment, it can be useful to have highly privilegedcode call less-privileged routines. For example, a user may request thaterrors in a privileged routine be reported by invoking a user-suppliederror-logging routine. To invoke the procedure, the privilege can bereduced via the branch-down instruction. The return from the procedureactually requires an increase in privilege, which must be carefullycontrolled. This is dealt with by placing the procedure call within alower-privilege procedure wrapper, which uses the branch-gatewayinstruction to return to the higher privilege region after the callthrough a secure re-entry point. Special care must be taken to ensurethat the less-privileged routine is not permitted to gain unauthorizedaccess by corruption of the stack or saved registers, such as by savingall registers and setting up a new stack frame (or restoring theoriginal lower-privilege stack) that may be manipulated by theless-privileged routine. Finally, such a technique is vulnerable to anunprivileged routine attempting to use the re-entry point directly, soit may be appropriate to keep a privileged state variable which controlspermission to enter at the re-entry point.

Improved Interprivilege Gateway—Branch Gateway

An exemplary embodiment of the Branch Gateway instruction is shown inFIGS. 21C-21F. In an exemplary embodiment, this operation provides asecure means to call a procedure, including those at a higher privilegelevel. An exemplary embodiment of the format and operation codes 2160 ofthe Branch Gateway instruction is shown in FIG. 21C.

An exemplary embodiment of the schematic 2170 of the Branch Gatewayinstruction is shown in FIG. 21D. In an exemplary embodiment, thecontents of register rb is a branch address in the high-order 62 bitsand a new privilege level in the low-order 2 bits. A branch and linkoccurs to the branch address, and the privilege level is raised to thenew privilege level. The high-order 62 bits of the successor to thecurrent program counter is catenated with the 2-bit current executionprivilege and placed in register 0.

In an exemplary embodiment, if the new privilege level is greater thanthe current privilege level, an octlet of memory data is fetched fromthe address specified by register 1, using the little-endian byte orderand a gateway access type. A GatewayDisallowed exception occurs if theoriginal contents of register 0 do not equal the memory data.

In an exemplary embodiment, if the new privilege level is the same asthe current privilege level, no checking of register 1 is performed.

In an exemplary embodiment, an AccessDisallowed exception occurs if thenew privilege level is greater than the privilege level required towrite the memory data, or if the old privilege level is lower than theprivilege required to access the memory data as a gateway, or if theaccess is not aligned on an 8-byte boundary.

In an exemplary embodiment, a ReservedInstruction exception occurs ifthe rc field is not one or the rd field is not zero.

In an exemplary embodiment, in the example in FIG. 21D, a gateway fromlevel 0 to level 2 is illustrated. The gateway pointer, located by thecontents of register rc (1), is fetched from memory and compared againstthe contents of register rb (0). The instruction may only complete ifthese values are equal. Concurrently, the contents of register rb (0) isplaced in the program counter and privilege level, and the address ofthe next sequential address and privilege level is placed into registerrd (0). Code at the target of the gateway locates the data pointer at anoffset from the gateway pointer (register 1), and fetches it intoregister 1, making a data region available. A stack pointer may be savedand fetched using the data region, another region located from the dataregion, or a data region located as an offset from the original gatewaypointer.

In an exemplary embodiment, this instruction gives the target procedurethe assurances that register 0 contains a valid return address andprivilege level, that register 1 points to the gateway location, andthat the gateway location is octlet aligned. Register 1 can then be usedto securely reach values in memory. If no sharing of literal pools isdesired, register 1 may be used as a literal pool pointer directly. Ifsharing of literal pools is desired, register 1 may be used with anappropriate offset to load a new literal pool pointer; for example, witha one cache line offset from the register 1. Note that because thevirtual memory system operates with cache line granularity, that severalgateway locations must be created together.

In an exemplary embodiment, software must ensure that an attempt to useany octlet within the region designated by virtual memory as gatewayeither functions properly or causes a legitimate exception. For example,if the adjacent octlets contain pointers to literal pool locations,software should ensure that these literal pools are not executable, orthat by virtue of being aligned addresses, cannot raise the executionprivilege level. If register 1 is used directly as a literal poollocation, software must ensure that the literal pool locations that areaccessible as a gateway do not lead to a security violation.

In an exemplary embodiment, register 0 contains a valid return addressand privilege level, the value is suitable for use directly in theBranch down (B.DOWN) instruction to return to the gateway callee.

An exemplary embodiment of the pseudocode 2190 of the Branch Gatewayinstruction is shown in FIG. 21E. An exemplary embodiment of theexceptions 2199 of the Branch Gateway instruction is shown in FIG. 21F.

Group Add

In accordance with one embodiment of the invention, the processorhandles a variety fix-point, or integer, group operations. For example,FIG. 26A presents various examples of Group Add instructionsaccommodating different operand sizes, such as a byte (8 bits), doublet(16 bits), quadlet (32 bits), octlet (64 bits), and hexlet (128 bits).FIGS. 26B and 26C illustrate an exemplary embodiment of a format andoperation codes that can be used to perform the various Group Addinstructions shown in FIG. 26A. As shown in FIGS. 26B and 26C, in thisexemplary embodiment, the contents of registers rc and rb arepartitioned into groups of operands of the size specified and added, andif specified, checked for overflow or limited, yielding a group ofresults, each of which is the size specified. The group of results iscatenated and placed in register rd. While the use of two operandregisters and a different result register is described here andelsewhere in the present specification, other arrangements, such as theuse of immediate values, may also be implemented.

In the present embodiment, for example, if the operand size specified isa byte (8 bits), and each register is 128-bit wide, then the content ofeach register may be partitioned into 16 individual operands, and 16different individual add operations may take place as the result of asingle Group Add instruction. Other instructions involving groups ofoperands may perform group operations in a similar fashion.

Group Set and Group Subtract

Similarly, FIG. 27A presents various examples of Group Set instructionsand Group Subtract instructions accommodating different operand sizes.FIGS. 27B and 27C illustrate an exemplary embodiment of a format andoperation codes that can be used to perform the various Group Setinstructions and Group Subtract instructions. As shown in FIGS. 27B and27C, in this exemplary embodiment, the contents of registers rc and rbare partitioned into groups of operands of the size specified and forGroup Set instructions are compared for a specified arithmetic conditionor for Group Subtract instructions are subtracted, and if specified,checked for overflow or limited, yielding a group of results, each ofwhich is the size specified. The group of results is catenated andplaced in register rd.

Ensemble Convolve, Divide, Multiply, Multiply Sum

In the present embodiment, other fix-point group operations are alsoavailable. FIG. 28A presents various examples of Ensemble Convolve,Ensemble Divide, Ensemble Multiply, and Ensemble Multiply Suminstructions accommodating different operand sizes. FIGS. 28B and 28Cillustrate an exemplary embodiment of a format and operation codes thatcan be used to perform the various Ensemble Convolve, Ensemble Divide,Ensemble Multiply and Ensemble Multiply Sum instructions. As shown inFIGS. 28B and 28C, in this exemplary embodiment, the contents ofregisters rc and rb are partitioned into groups of operands of the sizespecified and convolved or divided or multiplied, yielding a group ofresults, or multiplied and summed to a single result. The group ofresults is catenated and placed, or the single result is placed, inregister rd.

Ensemble Floating-Point Add, Divide, Multiply, and Subtract

In accordance with one embodiment of the invention, the processor alsohandles a variety floating-point group operations accommodatingdifferent operand sizes. Here, the different operand sizes may representfloating point operands of different precisions, such as half-precision(16 bits), single-precision (32 bits), double-precision (64 bits), andquad-precision (128 bits). FIG. 29 illustrates exemplary functions thatare defined for use within the detailed instruction definitions in othersections and figures. In the functions set forth in FIG. 29, an internalformat represents infinite-precision floating-point values as afour-element structure consisting of (1) s (sign bit): 0 for positive, 1for negative, (2) t (type): NORM, ZERO, SNAN, QNAN, INFINITY, (3) e(exponent), and (4) f: (fraction). The mathematical interpretation of anormal value places the binary point at the units of the fraction,adjusted by the exponent: (−1)̂^(s)*(2̂^(e))*f. The function F converts apacked IEEE floating-point value into internal format. The functionPackF converts an internal format back into IEEE floating-point format,with rounding and exception control.

FIGS. 30A and 31A present various examples of Ensemble Floating PointAdd, Divide, Multiply, and Subtract instructions. FIGS. 30B-C and 31B-Cillustrate an exemplary embodiment of formats and operation codes thatcan be used to perform the various Ensemble Floating Point Add, Divide,Multiply, and Subtract instructions. In these examples, EnsembleFloating Point Add, Divide, and Multiply instructions have been labeledas “EnsembleFloatingPoint.” Also, Ensemble Floating-Point Subtractinstructions have been labeled as “EnsembleReversedFloatingPoint.” Asshown in FIGS. 30B-C and 31B-C, in this exemplary embodiment, thecontents of registers rc and rb are partitioned into groups of operandsof the size specified, and the specified group operation is performed,yielding a group of results. The group of results is catenated andplaced in register rd.

In the present embodiment, the operation is rounded using the specifiedrounding option or using round-to-nearest if not specified. If arounding option is specified, the operation raises a floating-pointexception if a floating-point invalid operation, divide by zero,overflow, or underflow occurs, or when specified, if the result isinexact. If a rounding option is not specified, floating-pointexceptions are not raised, and are handled according to the defaultrules of IEEE 754.

Ensemble Scale-Add Floating-Point

A novel instruction, Ensemble-Scale-Add improves processor performanceby performing two sets of parallel multiplications and pairwise summingthe products. This improves performance for operations in which twovectors must be scaled by two independent values and then summed,providing two advantages over nearest prior art operations of afused-multiply-add. To perform this operation using prior artinstructions, two instructions would be needed, an ensemble-multiply forone vector and one scaling value, and an ensemble-multiply-add for thesecond vector and second scaling value, and these operations are clearlydependent. In contrast, the present invention fuses both the twomultiplies and the addition for each corresponding elements of thevectors into a single operation. The first advantage achieved isimproved performance, as in an exemplary embodiment the combinedoperation performs a greater number of multiplies in a single operation,thus improving utilization of the partitioned multiplier unit. Thesecond advantage achieved is improved accuracy, as an exemplaryembodiment may compute the fused operation with sufficient intermediateprecision so that no intermediate rounding the products is required.

An exemplary embodiment of the Ensemble Scale-Add Floating-pointinstruction is shown in FIGS. 22A-22B. In an exemplary embodiment, theseoperations take three values from registers, perform a group offloating-point arithmetic operations on partitions of bits in theoperands, and place the concatenated results in a register. An exemplaryembodiment of the format 2210 of the Ensemble Scale-Add Floating-pointinstruction is shown in FIG. 22A.

In an exemplary embodiment, the contents of registers rd and rc aretaken to represent a group of floating-point operands. Operands fromregister rd are multiplied with a floating-point operand taken from theleast-significant bits of the contents of register rb and added tooperands from register rc multiplied with a floating-point operand takenfrom the next least-significant bits of the contents of register rb. Theresults are rounded to the nearest representable floating-point value ina single floating-point operation. Floating-point exceptions are notraised, and are handled according to the default rules of IEEE 754. Theresults are catenated and placed in register ra.

An exemplary embodiment of the pseudocode 2230 of the Ensemble Scale-AddFloating-point instruction is shown in FIG. 22B. In an exemplaryembodiment, there are no exceptions for the Ensemble Scale-AddFloating-point instruction.

Performing a Three-Input Bitwise Boolean Operation in a SingleInstruction (Group Boolean)

In a further aspect of the present invention, a system and method isprovided for performing a three-input bitwise Boolean operation in asingle instruction. A novel method is used to encode the eight possibleoutput states of such an operation into only seven bits, and decodingthese seven bits back into the eight states.

An exemplary embodiment of the Group Boolean instruction is shown inFIGS. 23A-23C. In an exemplary embodiment, these operations takeoperands from three registers, perform boolean operations oncorresponding bits in the operands, and place the concatenated resultsin the third register. An exemplary embodiment of the format 2310 of theGroup Boolean instruction is shown in FIG. 23A.

An exemplary embodiment of a procedure 2320 of Group Boolean instructionis shown in FIG. 23B. In an exemplary embodiment, three values are takenfrom the contents of registers rd, rc and rb. The ih and il fieldsspecify a function of three bits, producing a single bit result. Thespecified function is evaluated for each bit position, and the resultsare catenated and placed in register rd. In an exemplary embodiment,register rd is both a source and destination of this instruction.

In an exemplary embodiment, the function is specified by eight bits,which give the result for each possible value of the three source bitsin each bit position:

d 1 1 1 1 0 0 0 0 c 1 1 0 0 1 1 0 0 b 1 0 1 0 1 0 1 0 f(d, c, b) f₇ f₆f₅ f₄ f₃ f₂ f₁ f₀

In an exemplary embodiment, a function can be modified by rearrangingthe bits of the immediate value. The table below shows how rearrangementof immediate value f_(7 . . . 0) can reorder the operands d, c, b forthe same function.

operation immediate f(d, c, b) f₇ f₆ f₅ f₄ f₃ f₂ f₁ f₀ f(c, d, b) f₇ f₆f₃ f₂ f₅ f₄ f₁ f₀ f(d, b, c) f₇ f₅ f₆ f₄ f₃ f₁ f₂ f₀ f(b, c, d) f₇ f₃ f₅f₁ f₆ f₂ f₄ f₀ f(c, b, d) f₇ f₅ f₃ f₁ f₆ f₄ f₂ f₀ f(b, d, c) f₇ f₃ f₆ f₂f₅ f₁ f₄ f₀

In an exemplary embodiment, by using such a rearrangement, an operationof the form: b=f(d,c,b) can be recoded into a legal form: b=f(b,d,c).For example, the function: b=f(d,c,b)=d?c:b cannot be coded, but theequivalent function: d=c?b:d can be determined by rearranging the codefor d=f(d,c,b)=d?c:b, which is 11001010, according to the rule forf(d,c,b)

f(c,b,d), to the code 11011000.

Encoding

In an exemplary embodiment, some special characteristics of thisrearrangement is the basis of the manner in which the eight functionspecification bits are compressed to seven immediate bits in thisinstruction. As seen in the table above, in the general case, arearrangement of operands from f(d,c,b) to f(d,b,c). (interchanging rcand rb) requires interchanging the values of f₆ and f₅ and the values off₂ and f₁.

In an exemplary embodiment, among the 256 possible functions which thisinstruction can perform, one quarter of them (64 functions) areunchanged by this rearrangement. These functions have the property thatf₆=f₅ and f₂=f₁. The values of rc and rb (Note that rc and rb are theregister specifiers, not the register contents) can be freelyinterchanged, and so are sorted into rising or falling order to indicatethe value of f₂. (A special case arises when rc=rb, so the sorting of rcand rb cannot convey information. However, as only the values f₇, f₄,f₃, and f₀ can ever result in this case, f₆, f₅, f₂, and f₁ need not becoded for this case, so no special handling is required.) Thesefunctions are encoded by the values of f₇, f₆, f₄, f₃, and f₀ in theimmediate field and f₂ by whether rc>rb, thus using 32 immediate valuesfor 64 functions.

In an exemplary embodiment, another quarter of the functions have f₆=1and f₅=0. These functions are recoded by interchanging rc and rb, f₆ andf₅, f₂ and f₁. They then share the same encoding as the quarter of thefunctions where f₆=0 and f₅=1, and are encoded by the values of f₇, f₄,f₃, f₂, f₁, and f₀ in the immediate field, thus using 64 immediatevalues for 128 functions.

In an exemplary embodiment, the remaining quarter of the functions havef₆=f₅ and f₂≠f₁. The half of these in which f₂=1 and f₁=0 are recoded byinterchanging rc and rb, f₆ and f₅, f₂ and f₁. They then share the sameencoding as the eighth of the functions where f₂=0 and f₁=1, and areencoded by the values of f₇, f₆, f₄, f₃, and f₀ in the immediate field,thus using 32 immediate values for 64 functions.

In an exemplary embodiment, the function encoding is summarized by thetable:

f₇ f₆ f₅ f₄ f₃ f₂ f₁ f₀ trc > trb ih il₅ il₄ il₃ il₂ il₁ il₀ rc rb f₆ f₂f₂ 0 0 f₆ f₇ f₄ f₃ f₀ trc trb f₆ f₂ ~f₂ 0 0 f₆ f₇ f₄ f₃ f₀ trb trc f₆ 01 0 1 f₆ f₇ f₄ f₃ f₀ trc trb f₆ 1 0 0 1 f₆ f₇ f₄ f₃ f₀ trb trc 0 1 1 f₂f₁ f₇ f₄ f₃ f₀ trc trb 1 0 1 f₁ f₂ f₇ f₄ f₃ f₀ trb trc

In an exemplary embodiment, the function decoding is summarized by thetable:

ih il₅ il₄ il₃ il₂ il₁ il₀ rc > rb f₇ f₆ f₅ f₄ f₃ f₂ f₁ f₀ 0 0 0 il₃ il₄il₄ il₂ il₁ 0 0 il₀ 0 0 1 il₃ il₄ il₄ il₂ il₁ 1 1 il₀ 0 1 il₃ il₄ il₄il₂ il₁ 0 1 il₀ 1 il₃ 0 1 il₂ il₁ il₅ il₄ il₀

From the foregoing discussion, it can be appreciated that an exemplaryembodiment of a compiler or assembler producing the encoded instructionperforms the steps above to encode the instruction, comparing the f6 andf5 values and the f2 and f1 values of the immediate field to determinewhich one of several means of encoding the immediate field is to beemployed, and that the placement of the trb and trc register specifiersinto the encoded instruction depends on the values of f2 (or f1) and f6(or f5).

An exemplary embodiment of the pseudocode 2330 of the Group Booleaninstruction is shown in FIG. 23C. It can be appreciated from the codethat an exemplary embodiment of a circuit that decodes this instructionproduces the f2 and f1 values, when the immediate bits ih and il5 arezero, by an arithmetic comparison of the register specifiers rc and rb,producing a one (1) value for f2 and f1 when rc>rb. In an exemplaryembodiment, there are no exceptions for the Group Boolean instruction.

Improving the Branch Prediction of Simple Repetitive Loops of Code

In yet a further aspect to the present invention, a system and method isdescribed for improving the branch prediction of simple repetitive loopsof code. In such a simple loop, the end of the loop is indicated by aconditional branch backward to the beginning of the loop. The conditionbranch of such a loop is taken for each iteration of the loop except thefinal iteration, when it is not taken. Prior art branch predictionsystems have employed finite state machine operations to attempt toproperly predict a majority of such conditional branches, but withoutspecific information as to the number of times the loop iterates, willmake an error in prediction when the loop terminates.

The system and method of the present invention includes providing acount field for indicating how many times a branch is likely to be takenbefore it is not taken, which enhances the ability to properly predictboth the initial and final branches of simple loops when a compiler candetermine the number of iterations that the loop will be performed. Thisimproves performance by avoiding misprediction of the branch at the endof a loop when the loop terminates and instruction execution is tocontinue beyond the loop, as occurs in prior art branch predictionhardware.

Branch Hint

An exemplary embodiment of the Branch Hint instruction is shown in FIGS.24A-24C. In an exemplary embodiment, this operation indicates a futurebranch location specified by a register.

In an exemplary embodiment, this instruction directs the instructionfetch unit of the processor that a branch is likely to occur count timesat simm instructions following the current successor instruction to theaddress specified by the contents of register rd. An exemplaryembodiment of the format 2410 of the Branch Hint instruction is shown inFIG. 24A.

In an exemplary embodiment, after branching count times, the instructionfetch unit presumes that the branch at simm instructions following thecurrent successor instruction is not likely to occur. If count is zero,this hint directs the instruction fetch unit that the branch is likelyto occur more than 63 times.

In an exemplary embodiment, an Access disallowed exception occurs if thecontents of register rd is not aligned on a quadlet boundary.

An exemplary embodiment of the pseudocode 2430 of the Branch Hintinstruction is shown in FIG. 24B. An exemplary embodiment of theexceptions 2460 of the Branch Hint instruction is shown in FIG. 24C.

Incorporating Floating Point Information into Processor Instructions

In a still further aspect of the present invention, a technique isprovided for incorporating floating point information into processorinstructions. In related U.S. Pat. No. 5,812,439, a system and methodare described for incorporating control of rounding and exceptions forfloating-point instructions into the instruction itself. The presentinvention extends this invention to include separate instructions inwhich rounding is specified, but default handling of exceptions is alsospecified, for a particular class of floating-point instructions.

Ensemble Sink Floating-Point

In an exemplary embodiment, a Ensemble Sink Floating-point instruction,which converts floating-point values to integral values, is availablewith control in the instruction that include all previously specifiedcombinations (default-near rounding and default exceptions,Z—round-toward-zero and trap on exceptions, N—round to nearest and trapon exceptions, F—floor rounding (toward minus infinity) and trap onexceptions, C—ceiling rounding (toward plus infinity) and trap onexceptions, and X—trap on inexact and other exceptions), as well asthree new combinations (Z.D—round toward zero and default exceptionhandling, F.D—floor rounding and default exception handling, andC.D—ceiling rounding and default exception handling). (The othercombinations: N.D is equivalent to the default, and X.D—trap on inexactbut default handling for other exceptions is possible but notparticularly valuable).

An exemplary embodiment of the Ensemble Sink Floating-point instructionis shown in FIGS. 25A-25C. In an exemplary embodiment, these operationstake one value from a register, perform a group of floating-pointarithmetic conversions to integer on partitions of bits in the operands,and place the concatenated results in a register. An exemplaryembodiment of the operation codes, selection, and format 2510 ofEnsemble Sink Floating-point instruction is shown in FIG. 25A.

In an exemplary embodiment, the contents of register rc is partitionedinto floating-point operands of the precision specified and converted tointeger values. The results are catenated and placed in register rd.

In an exemplary embodiment, the operation is rounded using the specifiedrounding option or using round-to-nearest if not specified. If arounding option is specified, unless default exception handling isspecified, the operation raises a floating-point exception if afloating-point invalid operation, divide by zero, overflow, or underflowoccurs, or when specified, if the result is inexact. If a roundingoption is not specified or if default exception handling is specified,floating-point exceptions are not raised, and are handled according tothe default rules of IEEE 754.

An exemplary embodiment of the pseudocode 2530 of the Ensemble SinkFloating-point instruction is shown in FIG. 25B. An exemplary embodimentof the exceptions 2560 of the Ensemble Sink Floating-point instructionis shown in FIG. 25C.

An exemplary embodiment of the pseudocode 2570 of the Floating-pointinstructions is shown in FIG. 25D.

Crossbar Compress, Expand, Rotate, and Shift

In one embodiment of the invention, crossbar switch units such as units142 and 148 perform data handling operations, as previously discussed.As shown in FIG. 32A, such data handling operations may include variousexamples of Crossbar Compress, Crossbar Expand, Crossbar Rotate, andCrossbar Shift operations. FIGS. 32B and 32C illustrate an exemplaryembodiment of a format and operation codes that can be used to performthe various Crossbar Compress, Crossbar Rotate, Crossbar Expand, andCrossbar Shift instructions. As shown in FIGS. 32B and 32C, in thisexemplary embodiment, the contents of register rc are partitioned intogroups of operands of the size specified, and compressed, expanded,rotated or shifted by an amount specified by a portion of the contentsof register rb, yielding a group of results. The group of results iscatenated and placed in register rd.

Various Group Compress operations may convert groups of operands fromhigher precision data to lower precision data. An arbitrary half-sizedsub-field of each bit field can be selected to appear in the result. Forexample, FIG. 32D shows an X.COMPRESS rd=rc,16,4 operation, whichperforms a selection of bits 19 . . . 4 of each quadlet in a hexlet.Various Group Shift operations may allow shifting of groups of operandsby a specified number of bits, in a specified direction, such as shiftright or shift left. As can be seen in FIG. 32C, certain Group ShiftLeft instructions may also involve clearing (to zero) empty low orderbits associated with the shift, for each operand. Certain Group ShiftRight instructions may involve clearing (to zero) empty high order bitsassociated with the shift, for each operand. Further, certain GroupShift Right instructions may involve filling empty high order bitsassociated with the shift with copies of the sign bit, for each operand.

Extract

In one embodiment of the invention, data handling operations may alsoinclude a Crossbar Extract instruction. FIGS. 33A and 33B illustrate anexemplary embodiment of a format and operation codes that can be used toperform the Crossbar Extract instruction. As shown in FIGS. 33A and 33B,in this exemplary embodiment, the contents of registers rd, rc, and rbare fetched. The specified operation is performed on these operands. Theresult is placed into register ra.

The Crossbar Extract instruction allows bits to be extracted fromdifferent operands in various ways. Specifically, bits 31 . . . 0 of thecontents of register rb specifies several parameters which control themanner in which data is extracted, and for certain operations, themanner in which the operation is performed. The position of the controlfields allows for the source position to be added to a fixed controlvalue for dynamic computation, and allows for the lower 16 bits of thecontrol field to be set for some of the simpler extract cases by asingle GCOPYI.128 instruction (see appendix). The control fields arefurther arranged so that if only the low order 8 bits are non-zero, a128-bit extraction with truncation and no rounding is performed:

The table below describes the meaning of each label:

label bits meaning fsize 8 field size dpos 8 destination position x 1reserved s 1 signed vs. unsigned n 1 reserved m 1 merge vs. extract l 1reserved rnd 2 reserved gssp 9 group size and source position

The 9-bit gssp field encodes both the group size, gsize, and sourceposition, spos, according to the formula gssp=512−4*gsize+spos. Thegroup size, gsize, is a power of two in the range 1 . . . 128. Thesource position, spos, is in the range 0 . . . (2*gsize)−1.

The values in the s, n, m, l, and rnd fields have the following meaning:

values s n m l rnd 0 unsigned extract 1 signed merge 2 3

As shown in FIG. 33C, for the X.EXTRACT instruction, when m=0, theparameters are interpreted to select a fields from the catenatedcontents of registers rd and rc, extracting values which are catenatedand placed in register ra. As shown in FIG. 33D, for acrossbar-merge-extract (X.EXTRACT when m=1), the parameters areinterpreted to merge a fields from the contents of register rd with thecontents of register rc. The results are catenated and placed inregister ra.

Shuffle

As shown in FIG. 34A, in one embodiment of the invention, data handlingoperations may also include various Shuffle instructions, which allowthe contents of registers to be partitioned into groups of operands andinterleaved in a variety of ways. FIGS. 34B and 34C illustrate anexemplary embodiment of a format and operation codes that can be used toperform the various Shuffle instructions. As shown in FIGS. 34B and 34C,in this exemplary embodiment, one of two operations is performed,depending on whether the re and rb fields are equal. Also, FIG. 34B andthe description below illustrate the format of and relationship of therd, re, rb, op, v, w, h, and size fields.

In the present embodiment, if the rc and rb fields are equal, a 128-bitoperand is taken from the contents of register rc. Items of size v aredivided into w piles and shuffled together, within groups of size bits,according to the value of op. The result is placed in register rd.

Further, if the rc and rb fields are not equal, the contents ofregisters rc and rb are catenated into a 256-bit operand. Items of sizev are divided into w piles and shuffled together, according to the valueof op. Depending on the value of h, a sub-field of op, the low 128 bits(h=0), or the high 128 bits (h=1) of the 256-bit shuffled contents areselected as the result. The result is placed in register rd.

As shown in FIG. 34D, an example of a crossbar 4-way shuffle of byteswithin hexlet instruction (X.SHUFFLE.128 rd=rcb,8,4) may divide the128-bit operand into 16 bytes and partitions the bytes 4 ways (indicatedby varying shade in the diagram below). The 4 partitions are perfectlyshuffled, producing a 128-bit result. As shown in FIG. 33E, an exampleof a crossbar 4-way shuffle of bytes within triclet instruction(X.SHUFFLE.256 rd=rc,rb,8,4,0) may catenate the contents of rc and rb,then divides the 256-bit content into 32 bytes and partitions the bytes4 ways (indicated by varying shade in the diagram below). The low-orderhalves of the 4 partitions are perfectly shuffled, producing a 128-bitresult.

Changing the last immediate value h to 1 (X.SHUFFLE.256 rd=rc,rb,8,4,1)may modify the operation to perform the same function on the high-orderhalves of the 4 partitions. When rc and rb are equal, the table belowshows the value of the op field and associated values for size, v, andw.

op size v w 0 4 1 2 1 8 1 2 2 8 2 2 3 8 1 4 4 16 1 2 5 16 2 2 6 16 4 2 716 1 4 8 16 2 4 9 16 1 8 10 32 1 2 11 32 2 2 12 32 4 2 13 32 8 2 14 32 14 15 32 2 4 16 32 4 4 17 32 1 8 18 32 2 8 19 32 1 16 20 64 1 2 21 64 2 222 64 4 2 23 64 8 2 24 64 16 2 25 64 1 4 26 64 2 4 27 64 4 4 28 64 8 429 64 1 8 30 64 2 8 31 64 4 8 32 64 1 16 33 64 2 16 34 64 1 32 35 128 12 36 128 2 2 37 128 4 2 38 128 8 2 39 128 16 2 40 128 32 2 41 128 1 4 42128 2 4 43 128 4 4 44 128 8 4 45 128 16 4 46 128 1 8 47 128 2 8 48 128 48 49 128 8 8 50 128 1 16 51 128 2 16 52 128 4 16 53 128 1 32 54 128 2 3255 128 1 64

When rc and rb are not equal, the table below shows the value of theop_(4 . . . 0) field and associated values for size, v, and w: Op₅ isthe value of h, which controls whether the low-order or high-order halfof each partition is shuffled into the result.

op4 . . . 0 size v w 0 256 1 2 1 256 2 2 2 256 4 2 3 256 8 2 4 256 16 25 256 32 2 6 256 64 2 7 256 1 4 8 256 2 4 9 256 4 4 10 256 8 4 11 256 164 12 256 32 4 13 256 1 8 14 256 2 8 15 256 4 8 16 256 8 8 17 256 16 8 18256 1 16 19 256 2 16 20 256 4 16 21 256 8 16 22 256 1 32 23 256 2 32 24256 4 32 25 256 1 64 26 256 2 64 27 256 1 128

CONCLUSION

Having fully described a preferred embodiment of the invention andvarious alternatives, those skilled in the art will recognize, given theteachings herein, that numerous alternatives and equivalents exist whichdo not depart from the invention. It is therefore intended that theinvention not be limited by the foregoing description, but only by theappended claims.

1. A data processing system comprising: (a) a bus coupling components inthe data processing system; (b) an external memory coupled to the bus;(c) a programmable microprocessor coupled to the bus and capable ofoperation independent of another host processor, the microprocessorcomprising: a virtual memory addressing unit; an instruction path and adata path; an external interface operable to receive data from anexternal source and communicate the received data over the data path; acache operable to retain data communicated between the externalinterface and the data path; at least one register file configurable toreceive and store data from the data path and to communicate the storeddata to the data path; and a multi-precision execution unit coupled tothe data path, the multi-precision execution unit configurable todynamically partition data received from the data path to account for anelemental width of the data wherein the elemental width of the data isequal to or narrower than the data path, the multi-precision executionunit being capable of performing group floating-point operations onmultiple operands in partitioned fields of operand registers andreturning catenated results. 2-30. (canceled)